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

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
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 2292 2007-09-28 14:47:14Z joachim $
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 Students Images" % len(students))
41count = 0
42chunk = 100
43for 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.