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

Last change on this file since 3004 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
RevLine 
[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 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
[2303]18
[2292]19mtool = context.portal_membership
20member = mtool.getAuthenticatedMember()
21if str(member) not in ('admin','joachim'):
22    return
[2303]23
24
[2292]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()
[2303]40logger.info("Start writing %d student images" % len(students))
[2292]41count = 0
[2337]42chunk = 50
[2292]43for student in students:
44    count += 1
45    if count and not count % chunk:
[2303]46        logger.info("written %d of %d student images " % (count,len(students)))
47        context.waeup_tool.doCommit()
[2292]48    context.waeup_tool.moveImagesToFS(student.id)
Note: See TracBrowser for help on using the repository browser.