Last change
on this file since 2300 was
2292,
checked in by joachim, 17 years ago
|
write student images to file, takes about 3 Minutes per 1000 Students on my system
|
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Rev | Line | |
---|
[2292] | 1 | ## Script (Python) "writeStudentImages" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: writeStudentImages.py 2292 2007-09-28 14:47:14Z joachim $ |
---|
| 11 | """ |
---|
| 12 | """ |
---|
| 13 | try: |
---|
| 14 | from Products.zdb import set_trace |
---|
| 15 | except: |
---|
| 16 | def set_trace(): |
---|
| 17 | pass |
---|
| 18 | |
---|
| 19 | mtool = context.portal_membership |
---|
| 20 | member = mtool.getAuthenticatedMember() |
---|
| 21 | if str(member) not in ('admin','joachim'): |
---|
| 22 | return |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | import logging |
---|
| 26 | import DateTime |
---|
| 27 | logger = logging.getLogger('Skins.writeStudentImages') |
---|
| 28 | |
---|
| 29 | request = context.REQUEST |
---|
| 30 | session = request.SESSION |
---|
| 31 | response = request.RESPONSE |
---|
| 32 | setheader = request.RESPONSE.setHeader |
---|
| 33 | def rwrite(s): |
---|
| 34 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
---|
| 35 | response.write("%s<br>\n\r" % s) |
---|
| 36 | |
---|
| 37 | #logger.info('') |
---|
| 38 | students = context.students_catalog() |
---|
| 39 | starttime = DateTime.DateTime() |
---|
| 40 | logger.info("Start writing %d Students Images" % len(students)) |
---|
| 41 | count = 0 |
---|
| 42 | chunk = 100 |
---|
| 43 | for student in students: |
---|
| 44 | count += 1 |
---|
| 45 | if count and not count % chunk: |
---|
| 46 | logger.info("written %d of %d Students Images " % (count,len(students))) |
---|
| 47 | context.waeup_tool.moveImagesToFS(student.id) |
---|
Note: See
TracBrowser for help on using the repository browser.