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:
- o = f.getObject()
- select_sql = "SELECT zbfile_id from zbfile WHERE media_id=%s AND file_nm='%s';" % (o.media_id, o.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, o.media_id, o.Title())
- LOG.info(update_sql)
- cursor.execute(update_sql)
- else:
- LOG.info( "zbfile not found in database, media_id: %s\tfile_nm:%s" % (o.media_id, o.Title()) )
Add Comment
Please, Sign In to add comment