Changeset 12920 for main/waeup.kofa/trunk
- Timestamp:
- 9 May 2015, 21:48:17 (10 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 3 added
- 3 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/docs/source/userdocs/testing.rst
r12915 r12920 4 4 ************************** 5 5 6 Doc 7 ======== =6 DocTests 7 ======== 8 8 9 9 .. toctree:: … … 16 16 testing/permissions 17 17 testing/userscontainer 18 testing/certificate 19 testing/batching 18 20 testing/batchprocessing 21 testing/accesscode 22 23 24 Python Tests 25 ============ -
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.txt
r7819 r12920 1 :mod:`waeup.kofa.accesscodes.accesscode` -- access codes (aka PINs)2 *********************** ********************************************1 Access Codes (aka PINs) 2 *********************** 3 3 4 4 .. module:: waeup.kofa.accesscodes.accesscode … … 9 9 .. :NOlayer: waeup.kofa.testing.KofaUnitTestLayer 10 10 11 About access-codes11 About Access Codes 12 12 ================== 13 13 … … 34 34 35 35 36 Access Code37 ========== 36 Access Code 37 =========== 38 38 39 39 .. class:: AccessCode(batch_serial, random_num[,invalidation_date=None[, student_id=None]]) 40 40 41 You normally shouldn't create standalone access -codes. Use41 You normally shouldn't create standalone access codes. Use 42 42 instances of :class:`AccessCodeBatch` instead as they generate them 43 43 (in masses) and care for them. … … 47 47 :class:`AccessCodeBatch`) to be kept. 48 48 49 Access -codes can have three states: unused, used, and50 disabled. While still unused but enabled access -codes are reflected49 Access codes can have three states: unused, used, and 50 disabled. While still unused but enabled access codes are reflected 51 51 by an empty ``invalidation_date`` (set to ``None``), an already 52 52 used (invalidated) code provides an invalidation date. 53 53 54 In case of misuse or similar cases access -codes can also be54 In case of misuse or similar cases access codes can also be 55 55 completely disabled by setting the ``disabled`` attribute to 56 56 ``True``. … … 133 133 134 134 135 Access CodeBatch136 =============== 135 Access Code Batch 136 ================= 137 137 138 138 .. class:: AccessCodeBatch(creation_date, creator, batch_prefix, cost, entry_num, num) 139 139 140 Create a batch of access -codes.140 Create a batch of access codes. 141 141 142 142 :param creation_date: python datetime … … 152 152 :class:`waeup.kofa.accesscodes.interfaces.IAccessCodeBatch`. 153 153 154 When creating a batch, all entries (access -codes) are generated as154 When creating a batch, all entries (access codes) are generated as 155 155 well. 156 156 … … 170 170 .. attribute:: entry_num 171 171 172 Number of entries (access -codes) inside the batch.172 Number of entries (access codes) inside the batch. 173 173 174 174 .. attribute:: invalidated_num … … 298 298 Lookup is done via local BTrees and therefore pretty fast. 299 299 300 Returns a list of access -codes found or empty list.300 Returns a list of access codes found or empty list. 301 301 302 302 … … 312 312 True 313 313 314 Creating a batch of three access -codes, with a cost of ``12.12`` per314 Creating a batch of three access codes, with a cost of ``12.12`` per 315 315 code, the batch prefix ``APP``, batch number ``10``, creator ID 316 316 ``Fred`` and some arbitrary creation date: … … 321 321 ... datetime.datetime(2009, 12, 23), 'Fred','APP', 12.12, 3, num=10) 322 322 323 Getting all access -codes from a batch:323 Getting all access codes from a batch: 324 324 325 325 >>> ac_codes = batch.entries() … … 472 472 # [] 473 473 474 Access CodeBatchContainer475 ======================== 474 Access Code Batch Container 475 =========================== 476 476 477 477 .. class:: AccessCodeBatchContainer() … … 540 540 be a string containing the full student ID. 541 541 542 Examples :543 -------- -542 Examples 543 -------- 544 544 545 545 Creating a batch container: … … 586 586 587 587 588 Access code plugin588 Access Code Plugin 589 589 ================== 590 590 … … 592 592 593 593 A `waeup.kofa` plugin that updates existing Kofa university 594 instances so that they provide support for access -codes.594 instances so that they provide support for access codes. 595 595 596 596 .. attribute:: grok.implements(IKofaPluggable) -
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser.txt
r11254 r12920 1 :mod:`waeup.kofa.accesscodes.browser` -- UI components for access-codes2 ****************************** *****************************************1 UI Components for Access Codes 2 ****************************** 3 3 4 4 .. module:: waeup.kofa.accesscodes.browser … … 45 45 46 46 47 Access -code management screen47 Access Code Management Screen 48 48 ============================= 49 49 … … 66 66 ... 67 67 68 Adding batches68 Adding Batches 69 69 ============== 70 70 … … 336 336 337 337 Enabling and Disabling Found Access Codes 338 ----------------------------------------- 338 ========================================= 339 339 340 340 If a search is successfull, we can enable or disable the found access … … 421 421 422 422 423 424 423 Archive files 425 424 ------------- -
main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt
r12868 r12920 1 Batch processing via browser1 Batch Processing via Browser 2 2 **************************** 3 3 … … 58 58 59 59 60 Batch processing faculties60 Batch Processing Faculties 61 61 ========================== 62 62 … … 166 166 167 167 168 Batch processing departments168 Batch Processing Departments 169 169 ============================ 170 170 … … 231 231 ...File:...departments_zope.mgr.csv... 232 232 233 Batch processing courses233 Batch Processing Courses 234 234 ======================== 235 235 … … 296 296 ...File:...courses_zope.mgr.csv... 297 297 298 Batch processing certificates298 Batch Processing Certificates 299 299 ============================= 300 300 … … 362 362 ...File:...certificates_zope.mgr.csv... 363 363 364 Batch processing certificate courses364 Batch Processing Certificate Courses 365 365 ==================================== 366 366 … … 427 427 ...File:...mycertcourses_zope.mgr.csv... 428 428 429 Batch processing users429 Batch Processing Users 430 430 ====================== 431 431 … … 499 499 ['waeup.PortalManager', 'waeup.AcademicsOfficer', 'waeup.ImportManager'] 500 500 501 Pending files501 Pending Files 502 502 ============= 503 503 … … 587 587 588 588 589 Fixing the pending file589 Fixing the Pending File 590 590 ----------------------- 591 591 -
main/waeup.kofa/trunk/src/waeup/kofa/browser/browser.txt
r12919 r12920 984 984 985 985 986 Certificate Courses987 ================== 986 Certificate Courses 987 =================== 988 988 989 989 Once we have a certificate, we can add also certificate courses. These … … 1030 1030 1031 1031 1032 Adding certificate courses1033 ------------------------- 1032 Adding certificate courses 1033 -------------------------- 1034 1034 1035 1035 Certcourses are stored in :class:`ICertificate` instances … … 1057 1057 ['--', 'COURSE1 - Course 1', 'COURSE2 - Course 2'] 1058 1058 1059 We select the first course and create our certificate course:1059 We select the first course and create our certificate course: 1060 1060 1061 1061 >>> ctrl.getControl('COURSE1').selected = True … … 1063 1063 >>> browser.getControl('Add certificate course').click() 1064 1064 1065 Our certificate course will be linked on the parent certificate page:1065 Our certificate course will be linked on the parent certificate page: 1066 1066 1067 1067 >>> browser.open(cert_url) … … 1070 1070 'http://localhost/my...sity/faculties/TF/TD/certificates/CERT1/COURSE1_100' 1071 1071 1072 We can't add the same certificate course twice:1072 We can't add the same certificate course twice: 1073 1073 1074 1074 >>> cert_url = dept_url + '/certificates/CERT1' … … 1082 1082 True 1083 1083 1084 When we started to add a new certificate course, we can also cancel the1084 When we started to add a new certificate course, we can also cancel the 1085 1085 process before submitting. This will bring us back to the certificate 1086 1086 page: … … 1092 1092 1093 1093 1094 Modifying certificate courses1095 ---------------------------- 1094 Modifying certificate courses 1095 ----------------------------- 1096 1096 1097 1097 We can change the settings for a certcourse by clicking on the … … 1137 1137 ... 1138 1138 1139 Searching certificate courses1140 ---------------------------- 1139 Searching certificate courses 1140 ----------------------------- 1141 1141 1142 1142 >>> browser.open('http://localhost/myuniversity/faculties/search') … … 1153 1153 True 1154 1154 1155 Deleting certificate courses1156 --------------------------- 1155 Deleting certificate courses 1156 ---------------------------- 1157 1157 1158 1158 We can delete certcourses by browsing the containing certificate manage page: -
main/waeup.kofa/trunk/src/waeup/kofa/catalog.txt
r7819 r12920 1 :mod:`waeup.kofa.catalog` -- Cataloging support Kofa 2 ****************** **********************************1 Cataloging Support 2 ****************** 3 3 4 4 .. module:: waeup.kofa.catalog … … 10 10 .. :layer: waeup.kofa.testing.KofaUnitTestLayer 11 11 12 .. contents:: 13 14 Classes 15 ======= 16 17 :class:`KofaQuery` 18 ------------------ 12 The KofaQuery Class 13 =================== 19 14 20 15 .. class:: KofaQuery() -
main/waeup.kofa/trunk/src/waeup/kofa/datacenter.txt
r9589 r12920 1 KofaData Center2 *********** *****1 Data Center 2 *********** 3 3 4 4 The Kofa data center cares for managing CSV files and importing then. … … 42 42 43 43 Managing the storage path 44 ------------------------- 44 ========================= 45 45 46 46 We can set another storage path: -
main/waeup.kofa/trunk/src/waeup/kofa/permissions.txt
r12900 r12920 1 Kofa permissions and roles2 ********************* *****1 Permissions and Roles 2 ********************* 3 3 4 4 Permissions and roles used in a Kofa portal. -
main/waeup.kofa/trunk/src/waeup/kofa/university/certcourses.txt
r9828 r12920 1 Certificate Courses 2 ******************* 3 4 Courses are referred to by certificate courses. 5 6 We can be sure, that when removing courses or referrers of them, 1 .. _removecertificatecourses: 2 3 Persistence of Certificate Courses 4 ================================== 5 6 If a certificate course requires a certain course and this is course 7 is deleted, also the referring certificate course is deleted. 8 9 We setup a data structure that reflects typical usage. It looks like 10 this:: 11 12 Department-Instance 13 | 14 +---> courses 15 | | 16 | +--------------------> Course-Instance 17 | ^ 18 +---> certificates | 19 | | 20 +-----> Certificate-Instance | 21 | | 22 +------> Certificate-Course 23 24 The Certifcate Course here refers to a Course instance. 25 26 In Python we build such a structure like this (from top to bottom): 27 28 >>> from zope.component import createObject 29 >>> mydept = createObject('waeup.Department') 30 31 In real world use this data will be stored in a ZODB. We setup our own 32 litte ZODB backend (which is easy!): 33 34 >>> from ZODB import FileStorage, DB 35 >>> dbpath = 'tinyData.fs' 36 >>> class TinyZODB(object): 37 ... def __init__(self, path=dbpath): 38 ... self.storage = FileStorage.FileStorage(path) 39 ... self.db = DB(self.storage) 40 ... self.connection = self.db.open() 41 ... self.dbroot = self.connection.root() 42 ... def close(self): 43 ... self.connection.close() 44 ... self.db.close() 45 ... self.storage.close() 46 47 Now we can use this ZODB as backend database and store our data 48 structure: 49 50 >>> import transaction 51 >>> db = TinyZODB() 52 >>> dbroot = db.dbroot 53 >>> dbroot['mydept'] = mydept 54 >>> mycourse = createObject('waeup.Course') 55 >>> mycourse.code = 'MYCOURSE' 56 >>> mydept.courses.addCourse(mycourse) 57 >>> mycert = createObject('waeup.Certificate') 58 >>> mycert.code = 'MYCERT' 59 >>> mydept.certificates.addCertificate(mycert) 60 >>> mycert.addCertCourse(mycourse) 61 62 >>> transaction.commit() 63 64 The data is now stored in the ZODB. We can close the DB, reopen it 65 later and the data will still be there: 66 67 >>> db.close() 68 >>> newdb = TinyZODB() 69 >>> newdbroot = newdb.dbroot 70 >>> list(newdbroot) 71 ['mydept'] 72 73 The certificate course we stored in the certificate is indeed a 74 referrer of the course, not a copy of it: 75 76 >>> course = newdbroot['mydept'].courses['MYCOURSE'] 77 >>> certcourse = newdbroot['mydept'].certificates['MYCERT']['MYCOURSE_100'] 78 >>> certcourse.course is course 79 True 80 81 So, we can be sure that modifications to the course are immediately 82 reflected in the certcourse. 83 84 We can also be sure, that when removing courses or referrers of them, 7 85 other data will be handled in a way we expect. That is, 8 86 … … 140 218 >>> list(fac['DEPT2'].courses) 141 219 [] 220 221 -
main/waeup.kofa/trunk/src/waeup/kofa/university/certificate.txt
r12104 r12920 1 :mod:`waeup.kofa.university.certificate` -- Certificates for Kofa 2 ************************************ ******************************1 Certificates and Certificate Courses 2 ************************************ 3 3 4 4 .. module:: waeup.kofa.university.certificate … … 234 234 <waeup.kofa.university.certificate.Certificate object at 0x...> 235 235 236 Certificate Courses237 ------------------ 236 Certificate Courses 237 ------------------- 238 238 239 239 :class:`CertificateCourse` instances comply with the … … 258 258 <waeup.kofa.university.certificate.CertificateCourse object at 0x...> 259 259 260 .. _removecertificatecourses:261 262 Persistence of certificate courses263 ----------------------------------264 265 If a certificate course requires a certain course and this is course266 is deleted, also the referring certificate course is deleted.267 268 We setup a data structure that reflects typical usage. It looks like269 this::270 271 Department-Instance272 |273 +---> courses274 | |275 | +--------------------> Course-Instance276 | ^277 +---> certificates |278 | |279 +-----> Certificate-Instance |280 | |281 +------> Certificate-Course282 283 The certifcate-Course here refers to a Course-Instance.284 285 In Python we build such a structure like this (from top to bottom):286 287 >>> from zope.component import createObject288 >>> mydept = createObject('waeup.Department')289 290 In real world use this data will be stored in a ZODB. We setup our own291 litte ZODB backend (which is easy!):292 293 >>> from ZODB import FileStorage, DB294 >>> dbpath = 'tinyData.fs'295 >>> class TinyZODB(object):296 ... def __init__(self, path=dbpath):297 ... self.storage = FileStorage.FileStorage(path)298 ... self.db = DB(self.storage)299 ... self.connection = self.db.open()300 ... self.dbroot = self.connection.root()301 ... def close(self):302 ... self.connection.close()303 ... self.db.close()304 ... self.storage.close()305 306 Now we can use this ZODB as backend database and store our data307 structure:308 309 >>> import transaction310 >>> db = TinyZODB()311 >>> dbroot = db.dbroot312 >>> dbroot['mydept'] = mydept313 >>> mycourse = createObject('waeup.Course')314 >>> mycourse.code = 'MYCOURSE'315 >>> mydept.courses.addCourse(mycourse)316 >>> mycert = createObject('waeup.Certificate')317 >>> mycert.code = 'MYCERT'318 >>> mydept.certificates.addCertificate(mycert)319 >>> mycert.addCertCourse(mycourse)320 321 >>> transaction.commit()322 323 The data is now stored in the ZODB. We can close the DB, reopen it324 later and the data will still be there:325 326 >>> db.close()327 >>> newdb = TinyZODB()328 >>> newdbroot = newdb.dbroot329 >>> list(newdbroot)330 ['mydept']331 332 The certificate course we stored in the certificate is indeed a333 referrer of the course, not a copy of it:334 335 >>> course = newdbroot['mydept'].courses['MYCOURSE']336 >>> certcourse = newdbroot['mydept'].certificates['MYCERT']['MYCOURSE_100']337 >>> certcourse.course is course338 True339 340 So, we can be sure that modifications to the course are immediately341 reflected in the certcourse.342 -
main/waeup.kofa/trunk/src/waeup/kofa/userscontainer.txt
r12079 r12920 1 User container for the Kofa2 *************** ************1 Users Container 2 *************** 3 3 4 4 .. :doctest: -
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.txt
r12868 r12920 1 :mod:`waeup.kofa.utils.batching` -- Batch processing2 **************** ************************************1 Batch Processing 2 **************** 3 3 4 4 Batch processing is much more than pure data import. … … 75 75 76 76 77 Creating a batch processor77 Creating a Batch Processor 78 78 ========================== 79 79 … … 361 361 362 362 363 364 365 Updating entries 363 Updating Entries 366 364 ---------------- 367 365 … … 523 521 >>> shutil.rmtree(os.path.dirname(result[2])) 524 522 525 Removing entries523 Removing Entries 526 524 ---------------- 527 525
Note: See TracChangeset for help on using the changeset viewer.