Changeset 2609 for WAeUP_SRP/base/skins/waeup_utilities
- Timestamp:
- 9 Nov 2007, 15:38:22 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_utilities/ti_391_resolve.py
r2605 r2609 28 28 from Products.AdvancedQuery import Eq, Between, Le,In 29 29 aq_portal = context.portal_catalog_real.evalAdvancedQuery 30 students_folder = context.portal_url.getPortalObject().campus.students 30 31 31 32 request = context.REQUEST … … 39 40 #logger.info('') 40 41 41 query = Eq('portal_type','StudentPersonal')42 #brains = context.students_catalog()43 brains = aq_portal(query)42 #query = Eq('portal_type','StudentPersonal') 43 #brains = aq_portal(query) 44 brains = context.students_catalog() 44 45 total = len(brains) 45 46 #rwrite("found %d " % total) … … 47 48 edited = 0 48 49 count = 0 50 commit_after = 50 49 51 logger.info('started for %d' % total) 50 52 for brain in brains: 51 53 count += 1 52 doc = brain.getObject().getContent() 53 if doc.email and doc.email.find('@') < 0: 54 if no_email and not no_email % commit_after: 55 context.waeup_tool.doCommit() 56 logger.info("Committing %s transactions, total %s" % (commit_after,count)) 57 if not brain.email or brain.email.find('@') < 0: 54 58 no_email += 1 55 #rwrite ("%s email = %s" % (brain.getId,doc.email))56 59 try: 57 app_doc = getattr(brain.getObject().aq_parent,'application').getContent() 58 logger.info("setting email of %s from %s to %s" % (brain.getPath().split('/')[-2], 59 doc.email, 60 app_doc.app_email)) 61 doc.edit(mapping={'email': app_doc.app_email}) 62 edited += 1 60 app_doc = getattr(getattr(students_folder,brain.id),'application').getContent() 61 #rwrite ("%s email = %s" % (brain.getId,doc.email)) 63 62 except: 64 logger.info("failed to set email of %s from %s" % (brain.getPath().split('/')[-2], 65 doc.email, 66 )) 67 pass 63 logger.info("failed to get application object of %s" % (brain.id,)) 64 continue 65 if not app_doc.app_email or app_doc.app_email.find('@') < 0: 66 logger.info("%s both emails %s/%s are invalid" % (brain.id, 67 app_doc.app_email, 68 brain.email)) 69 continue 70 try: 71 per_doc = getattr(getattr(students_folder,brain.id),'personal').getContent() 72 #rwrite ("%s email = %s" % (brain.getId,doc.email)) 73 except: 74 logger.info("failed to get personal object of %s" % (brain.id,)) 75 continue 76 logger.info("setting email of %s from %s to %s" % (brain.id, 77 per_doc.email, 78 app_doc.app_email)) 79 per_doc.edit(mapping={'email': app_doc.app_email}) 80 edited += 1 68 81 else: 69 82 #rwrite ("%s email = %s" % (brain.getPath(),doc.email))
Note: See TracChangeset for help on using the changeset viewer.