Last change
on this file since 3098 was
2337,
checked in by Henrik Bettermann, 17 years ago
|
switch to File Image Widget
|
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Line | |
---|
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 2337 2007-10-10 08:14:26Z henrik $ |
---|
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 student images" % len(students)) |
---|
41 | count = 0 |
---|
42 | chunk = 50 |
---|
43 | for student in students: |
---|
44 | count += 1 |
---|
45 | if count and not count % chunk: |
---|
46 | logger.info("written %d of %d student images " % (count,len(students))) |
---|
47 | context.waeup_tool.doCommit() |
---|
48 | context.waeup_tool.moveImagesToFS(student.id) |
---|
Note: See
TracBrowser for help on using the repository browser.