source: WAeUP_SRP/base/skins/waeup_utilities/writeStudentImages.py @ 2493

Last change on this file since 2493 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"""
13try:
14    from Products.zdb import set_trace
15except:
16    def set_trace():
17        pass
18
19mtool = context.portal_membership
20member = mtool.getAuthenticatedMember()
21if str(member) not in ('admin','joachim'):
22    return
23
24
25import logging
26import DateTime
27logger = logging.getLogger('Skins.writeStudentImages')
28
29request = context.REQUEST
30session = request.SESSION
31response = request.RESPONSE
32setheader = request.RESPONSE.setHeader
33def 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('')
38students = context.students_catalog()
39starttime = DateTime.DateTime()
40logger.info("Start writing %d student images" % len(students))
41count = 0
42chunk = 50
43for 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.