Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def updatezbfilesizes(self):
- catalog = getToolByName(self, 'portal_catalog')
- zbfiles = catalog.searchResults(portal_type='ZBFile')
- for f in zbfiles:
- select_sql = "SELECT zbfile_id from zbfile WHERE media_id=%s AND file_nm='%s';" % (f.media_id, f.Title)
- LOG.info(select_sql)
- cursor.execute(select_sql)
- row = cursor.fetchone()
- if row != None:
- update_sql = "UPDATE zbfile SET file_size=%s WHERE media_id=%s AND file_nm='%s';" % (f.get_size, f.media_id, f.Title)
- LOG.info(update_sql)
- cursor.execute(update_sql)
- else:
- LOG.info( "zbfile not found in database, media_id: %s\tfile_nm:%s" % (f.media_id, f.Title) )
Add Comment
Please, Sign In to add comment