Changeset 12858
- Timestamp:
- 16 Apr 2015, 12:03:32 (10 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/docs/source/userdocs/datacenter.rst
r12857 r12858 13 13 Kofa's persistent data are stored in a native object database designed for the Python programming language, the so-called ZODB_. An object database stores objects with attributes and not records as rows with columns in tables. These persistent objects can hold any kind of information in attributes and must not adhere to a specific schema like records in tables of a relational database. 14 14 15 The ZODB_ also supports a hierarchical, treelike storage of objects. Objects can contain other objects if they are declared as containers. Objects are stored like folders and files in a filesystem. This makes the object handling very fast and transparent because we can access objects, or more precisely views of objects, by indicating their path in the database, i.e. by traversing the database tree to find an object. Furthermore, we are accessing the views of objects through a web browser by entering a URL (Uniform Resource Locator). This publication path corresponds more or less to the traversal path of our objects. In Kofa the path always contains the object identifiers of all objects which are passed when traversing the database tree. Example:15 The ZODB_ also supports a hierarchical, treelike storage of objects. Objects can contain other objects if they are declared as containers. Objects are stored like folders and files in a filesystem. This makes the object handling very fast and transparent because we can access objects, or more precisely views of objects, by indicating their path in the database, i.e. by traversing the database tree to the object's location. Furthermore, we are accessing the views of objects through a web browser by entering a URL (Uniform Resource Locator). This publication path corresponds more or less to the traversal path of our objects. In Kofa the path always contains the object identifiers of all objects which are passed when traversing the database tree. Example: 16 16 17 17 https://kofa-demo.waeup.org/students/K1000000/studycourse/100/DCO 18 18 19 is the URL which requests a display view of a course ticket with id 'DCO'. This object is stored in a study level container object with id '100', stored in a study course container object with id 'studycourse', stored in the student container object with id 'K1000000', stored in the students root container, stored in the root container of the application, stored in the root of the database itself.19 is the URL which requests a display view of a course ticket with id ``DCO``. This object is stored in a study level container object with id ``100``, stored in a study course container object with id ``studycourse``, stored in the student container object with id ``K1000000``, stored in the students root container, stored in the root container of the application, stored in the root of the database itself. 20 20 21 21 This kind of storage requires that each object gets a unique object identifier (object id) within its container. The id string is visible in the browser address bar. Though it's technically possible for ids to contain spaces or slashes we do not allow these kinds of special characters in object ids to facilitate the readability of URLs. … … 26 26 =========== 27 27 28 Regular data exporters (1) collect objects from specific containers, (2) iterate over the collected objects, (3) extract and mangle information from each object, (4) write the information of each object into a row of a CSV file and (5) finally provide the file for download. The CSV file is neither stored in the database nor archived in the filesystem. (3) and (4) is a flattening of the hierarchical data structure, i.e. a mapping of objects to flat relational data stored in a CSV table. The extracted information must not necessarily be based only on static attributes of the collected object. The data, finally stored in the CSV file, can also be derived from parent or child objects, or dynamically computed by the object's methods and property attributes. These methods and properties can retrieve information from everywhere in the portal's database. 28 Regular data exporters (1) collect objects from specific containers, (2) iterate over the collected objects, (3) extract and mangle information from each object, (4) write the information of each object into a row of a CSV file and (5) finally provide the file for download. The CSV file is neither stored in the database nor archived in the filesystem. (3) and (4) means a flattening of the hierarchical data structure, i.e. a mapping of objects to flat relational data to be stored in a CSV table. The extracted information must not necessarily be based only on static attributes of the collected object. The data, finally stored in the CSV file, can also be derived from parent or child objects, or dynamically computed by the object's methods and property attributes. These methods and properties can retrieve information from everywhere in the portal's database. 29 30 In the following we list all exporter classes including the two attributes and a method description. The `fields` attribute contain the column titles of the export file. These are not necessarily only attributes of the exported objects. The `title` attribute unveils the name of the exporter under which this exporter will be displayed in the user interface. The `mangle_value()` method shows how some of fields are being dynamically computed. 31 32 Academic Section Exporters 33 -------------------------- 29 34 30 35 .. autoclass:: waeup.kofa.university.export.FacultyExporter() … … 33 38 .. autoattribute:: waeup.kofa.university.export.FacultyExporter.fields 34 39 .. autoattribute:: waeup.kofa.university.export.FacultyExporter.title 35 36 40 .. automethod:: waeup.kofa.university.export.FacultyExporter.mangle_value() 37 41 38 42 43 .. autoclass:: waeup.kofa.university.export.DepartmentExporter() 44 :noindex: 45 46 .. autoattribute:: waeup.kofa.university.export.DepartmentExporter.fields 47 .. autoattribute:: waeup.kofa.university.export.DepartmentExporter.title 48 .. automethod:: waeup.kofa.university.export.DepartmentExporter.mangle_value() 49 50 .. autoclass:: waeup.kofa.university.export.CourseExporter() 51 :noindex: 52 53 .. autoattribute:: waeup.kofa.university.export.CourseExporter.fields 54 .. autoattribute:: waeup.kofa.university.export.CourseExporter.title 55 .. automethod:: waeup.kofa.university.export.CourseExporter.mangle_value() 56 57 .. autoclass:: waeup.kofa.university.export.CertificateExporter() 58 :noindex: 59 60 .. autoattribute:: waeup.kofa.university.export.CertificateExporter.fields 61 .. autoattribute:: waeup.kofa.university.export.CertificateExporter.title 62 .. automethod:: waeup.kofa.university.export.CertificateExporter.mangle_value() 63 64 .. autoclass:: waeup.kofa.university.export.CertificateCourseExporter() 65 :noindex: 66 67 .. autoattribute:: waeup.kofa.university.export.CertificateCourseExporter.fields 68 .. autoattribute:: waeup.kofa.university.export.CertificateCourseExporter.title 69 .. automethod:: waeup.kofa.university.export.CertificateCourseExporter.mangle_value() 70 71 72 Application Section Exporters 73 ----------------------------- 74 75 76 Student Section Exporters 77 ------------------------- 39 78 40 79 -
main/waeup.kofa/trunk/src/waeup/kofa/browser/captcha.py
r11254 r12858 286 286 287 287 The ``error_code`` can be taken from a previously fetched 288 :class:` `CaptchaResponse`` instance (as returned by289 :meth:` `verify``). If it is not ``None``, it might be288 :class:`CaptchaResponse` instance (as returned by 289 :meth:`verify`). If it is not ``None``, it might be 290 290 displayed inside the generated captcha box (in human readable 291 291 form). -
main/waeup.kofa/trunk/src/waeup/kofa/university/export.py
r12857 r12858 24 24 from waeup.kofa.utils.batching import ExporterBase 25 25 26 26 27 class FacultyExporter(grok.GlobalUtility, ExporterBase): 27 """The Faculty Exporter exports all faculties in the 'faculties'28 """The Faculty Exporter exports all faculties in the 'faculties' 28 29 container. This is the only place where faculties are stored. 29 30 """ … … 36 37 37 38 def mangle_value(self, value, name, context=None): 38 """The users_with_local_roles column contains Python expression like: 39 """The mangler computes the users_with_local_roles value which 40 is a Python expression like: 39 41 40 42 ``[{'user_name': u'bob', 'local_role': u'bobsrole'}, … … 66 68 return self.export(faculties.values(), filepath) 67 69 70 68 71 class DepartmentExporter(FacultyExporter, grok.GlobalUtility): 69 """Exporter for departments. 72 """The Department Exporter exports all departments stored in the faculty 73 containers. The exporter iterates over all faculties and then over all 74 departments inside each faculty container. 70 75 """ 71 76 grok.implements(ICSVExporter) 72 77 grok.name('departments') 73 78 74 #: Fieldnames considered by this exporter75 79 fields = ('code', 'faculty_code', 'title', 'title_prefix', 76 80 'users_with_local_roles') … … 79 83 80 84 def mangle_value(self, value, name, context=None): 81 """Hook for mangling values in derived classes 85 """The mangler additionally computes the faculty_code value 86 which is the code (= object id) of the faculty that hosts 87 the department. 82 88 """ 83 89 if name == 'faculty_code': … … 101 107 102 108 class CourseExporter(FacultyExporter, grok.GlobalUtility): 103 """Exporter for courses. 109 """The Course Exporter exports all courses in the database. It iterates 110 over all departments and faculties. 104 111 """ 105 112 grok.implements(ICSVExporter) 106 113 grok.name('courses') 107 114 108 #: Fieldnames considered by this exporter109 115 fields = ('code', 'faculty_code', 'department_code', 'title', 'credits', 110 116 'passmark', 'semester', 'users_with_local_roles', 'former_course') 111 117 112 #: The title under which this exporter will be displayed113 118 title = _(u'Courses') 114 119 115 120 def mangle_value(self, value, name, context=None): 116 """ 121 """The mangler additionally computes the department_code value 122 which is the code of the department that offers the course. 117 123 """ 118 124 if name == 'users_with_local_roles': … … 137 143 def export_all(self, site, filepath=None): 138 144 """Export courses into filepath as CSV data. 139 140 145 If `filepath` is ``None``, a raw string with CSV data is returned. 141 146 """ … … 148 153 return self.close_outfile(filepath, outfile) 149 154 155 150 156 class CertificateExporter(CourseExporter, grok.GlobalUtility): 151 """Exporter for courses. 157 """The Certificate Exporter exports all certificates in the database. 158 It iterates over all departments and faculties. 152 159 """ 153 160 grok.implements(ICSVExporter) 154 161 grok.name('certificates') 155 162 156 #: Fieldnames considered by this exporter157 163 fields = ('code', 'faculty_code', 'department_code', 'title', 'study_mode', 158 164 'start_level', 'end_level', 'application_category', 'ratio', … … 162 168 'users_with_local_roles') 163 169 164 #: The title under which this exporter will be displayed165 170 title = _(u'Certificates') 166 171 172 def mangle_value(self, value, name, context=None): 173 """The mangler additionally computes the department_code value 174 which is the code of the department that offers the certificate. 175 """ 176 return super(CertificateExporter, self).mangle_value( 177 value, name, context) 178 167 179 def export_all(self, site, filepath=None): 168 180 """Export certificates into filepath as CSV data. 169 170 181 If `filepath` is ``None``, a raw string with CSV data is returned. 171 182 """ … … 178 189 return self.close_outfile(filepath, outfile) 179 190 191 180 192 class CertificateCourseExporter(CourseExporter, grok.GlobalUtility): 181 """Exporter for courses. 193 """The Certificate Course Exporter exports all certificate courses 194 (:class:`CertificateCourse 195 <waeup.kofa.university.certificate.CertificateCourse>` instances) in 196 the database. It iterates over all departments and faculties. 182 197 """ 183 198 grok.implements(ICSVExporter) 184 199 grok.name('certificate_courses') 185 200 186 #: Fieldnames considered by this exporter187 201 fields = ('course', 'faculty_code', 'department_code', 'certificate_code', 188 202 'level', 'mandatory') 189 203 190 #: The title under which this exporter will be displayed191 204 title = _(u'Courses in Certificates') 192 205 193 206 def mangle_value(self, value, name, context=None): 194 """Hook for mangling values in derived classes 207 """The mangler computes the codes of the faculty, the department and 208 the certificate which require the course. It also exports the 209 course code. 210 211 .. note:: The course must not necessarily be offered by the same 212 department. 195 213 """ 196 214 if name == 'faculty_code': … … 214 232 def export_all(self, site, filepath=None): 215 233 """Export certificate courses into filepath as CSV data. 216 217 234 If `filepath` is ``None``, a raw string with CSV data is returned. 218 235 """
Note: See TracChangeset for help on using the changeset viewer.