Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import MySQLdb
- dbconn = MySQLdb.connect( host='192.168.100.85', port=3306, user='zope', passwd='zope', db='zb_logs' )
- cursor = dbconn.cursor()
- #########################################
- def getDBFilename(zbfile_id):
- query = "select file_nm from zbfile where zbfile_id = '%s'" % zbfile_id
- cursor.execute(query)
- result = cursor.fetchone()
- try:
- return result[0]
- except:
- return ""
- #########################################
- def no_zbfile_id(self):
- """
- if obj.zbfile_id doesn't exist
- """
- pcat = self.portal_catalog
- zbfiles = pcat(portal_type='ZBFile')
- count = 0
- print "file_nm, start_date, end_date, size, duration, client_id, project_id, media_id"
- for f in zbfiles:
- obj = f.getObject()
- if not obj.zbfile_id or obj.zbfile_id == "":
- print ",".join([obj.Title(),str(obj.start_date),str(obj.end_date),str(obj.get_size()), str(obj.duration), str(obj.client_id), str(obj.project_id), str(obj.media_id)])
- def incorrect_zbfile_id(self):
- """
- if obj.Title() != zbfile.file_nm
- """
- pcat = self.portal_catalog
- zbfiles = pcat(portal_type='ZBFile')
- print "zbfile_id, file_nm, start_date, end_date, size, duration, client_id, project_id, media_id"
- for f in zbfiles:
- obj = f.getObject()
- if not obj.zbfile_id:continue
- dbfilename = getDBFilename(obj.zbfile_id)
- if dbfilename != obj.Title():
- print ",".join([str(obj.zbfile_id), obj.Title(),str(obj.start_date),str(obj.end_date),str(obj.get_size()), str(obj.duration), str(obj.client_id), str(obj.project_id), str(obj.media_id)])
Add Comment
Please, Sign In to add comment