Пример #1
0
 def text2blob(self):
     #DOC,errno,why = ESSMETS.parseMetsFromFile('/ESSArch/bin/src/testdata/X0000001_METS.xml')
     DOC,errno,why = ESSMD.parseFromFile('/ESSArch/bin/src/testdata/X0000001_METS.xml')
     if errno:
         print why
     METSstr = etree.tostring(DOC,encoding='UTF-8', xml_declaration=True, pretty_print=True)
     blob = MySQLdb.escape_string(METSstr)
     print 'METSstr',METSstr
     print 'blob',blob
     #self.table = 'IngestObjectMetadata'
     ArchiveObjectMetadata_obj = ArchiveObjectMetadata()
     ArchiveObjectMetadata_obj.ObjectIdentifierValue = ObjectIdentifierValue
     ArchiveObjectMetadata_obj.ObjectMetadataType = 26
     ArchiveObjectMetadata_obj.ObjectMetadataBLOB = blob
     ArchiveObjectMetadata_obj.save() 
Пример #2
0
 def text2blob(self):
     #DOC,errno,why = ESSMETS.parseMetsFromFile('/ESSArch/bin/src/testdata/X0000001_METS.xml')
     DOC, errno, why = ESSMD.parseFromFile(
         '/ESSArch/bin/src/testdata/X0000001_METS.xml')
     if errno:
         print why
     METSstr = etree.tostring(DOC,
                              encoding='UTF-8',
                              xml_declaration=True,
                              pretty_print=True)
     blob = MySQLdb.escape_string(METSstr)
     print 'METSstr', METSstr
     print 'blob', blob
     #self.table = 'IngestObjectMetadata'
     ArchiveObjectMetadata_obj = ArchiveObjectMetadata()
     ArchiveObjectMetadata_obj.ObjectIdentifierValue = ObjectIdentifierValue
     ArchiveObjectMetadata_obj.ObjectMetadataType = 26
     ArchiveObjectMetadata_obj.ObjectMetadataBLOB = blob
     ArchiveObjectMetadata_obj.save()
Пример #3
0
 if FTPflag and DBflag:
     self.timestamp_utc = datetime.datetime.utcnow().replace(
         microsecond=0, tzinfo=pytz.utc)
     self.timestamp_dst = self.timestamp_utc.astimezone(self.tz)
     ArchiveObject_obj = ArchiveObject.objects.get(
         ObjectUUID=ObjectUUID)
     ArchiveObjectMetadata_obj = ArchiveObjectMetadata()
     ArchiveObjectMetadata_obj.ObjectUUID = ArchiveObject_obj
     ArchiveObjectMetadata_obj.ObjectIdentifierValue = ObjectIdentifierValue
     ArchiveObjectMetadata_obj.ObjectMetadataType = ObjectMetadataType
     ArchiveObjectMetadata_obj.ObjectMetadataServer = self.ftp_res[0]
     ArchiveObjectMetadata_obj.ObjectMetadataURL = self.ftp_res[1]
     ArchiveObjectMetadata_obj.ObjectMetadataBLOB = blob
     ArchiveObjectMetadata_obj.linkingAgentIdentifierValue = AgentIdentifierValue
     ArchiveObjectMetadata_obj.LocalDBdatetime = self.timestamp_utc
     ArchiveObjectMetadata_obj.save()
     #            res,errno,why =  ESSDB.DB().action('IngestObjectMetadata','INS',('ObjectUUID',ObjectUUID,
     #                                                                 'ObjectIdentifierValue',ObjectIdentifierValue,
     #                                                                 'ObjectMetadataType',ObjectMetadataType,
     #                                                                 'ObjectMetadataServer',self.ftp_res[0],
     #                                                                 'ObjectMetadataURL',self.ftp_res[1],
     #                                                                 'ObjectMetadataBLOB',blob,
     #                                                                 'linkingAgentIdentifierValue',AgentIdentifierValue,
     #                                                                 'LocalDBdatetime',self.timestamp_utc.replace(tzinfo=None)))
     #            if errno: return '',40,'errno: %s, why: %s' % (str(errno),str(why))
     #            if errno == 0 and ExtDBupdate:
     if ExtDBupdate:
         ext_res, ext_errno, ext_why = ESSMSSQL.DB().action(
             'IngestObjectMetadata', 'INS',
             ('ObjectIdentifierValue', ObjectIdentifierValue,
              'ObjectMetadataType', ObjectMetadataType,
Пример #4
0
            #print 'blob_MSSQL2 Start#%s#END' % blob_mssql
        
        if FTPflag and DBflag:
            self.timestamp_utc = datetime.datetime.utcnow().replace(microsecond=0,tzinfo=pytz.utc)
            self.timestamp_dst = self.timestamp_utc.astimezone(self.tz)
            ArchiveObject_obj = ArchiveObject.objects.get(ObjectUUID = ObjectUUID)
            ArchiveObjectMetadata_obj = ArchiveObjectMetadata()
            ArchiveObjectMetadata_obj.ObjectUUID = ArchiveObject_obj
            ArchiveObjectMetadata_obj.ObjectIdentifierValue = ObjectIdentifierValue
            ArchiveObjectMetadata_obj.ObjectMetadataType = ObjectMetadataType
            ArchiveObjectMetadata_obj.ObjectMetadataServer = self.ftp_res[0]
            ArchiveObjectMetadata_obj.ObjectMetadataURL = self.ftp_res[1]
            ArchiveObjectMetadata_obj.ObjectMetadataBLOB = blob
            ArchiveObjectMetadata_obj.linkingAgentIdentifierValue = AgentIdentifierValue
            ArchiveObjectMetadata_obj.LocalDBdatetime = self.timestamp_utc.replace(tzinfo=None)
            ArchiveObjectMetadata_obj.save()       
#            res,errno,why =  ESSDB.DB().action('IngestObjectMetadata','INS',('ObjectUUID',ObjectUUID,
#                                                                 'ObjectIdentifierValue',ObjectIdentifierValue,
#                                                                 'ObjectMetadataType',ObjectMetadataType,
#                                                                 'ObjectMetadataServer',self.ftp_res[0],
#                                                                 'ObjectMetadataURL',self.ftp_res[1],
#                                                                 'ObjectMetadataBLOB',blob,
#                                                                 'linkingAgentIdentifierValue',AgentIdentifierValue,
#                                                                 'LocalDBdatetime',self.timestamp_utc.replace(tzinfo=None)))
#            if errno: return '',40,'errno: %s, why: %s' % (str(errno),str(why))
#            if errno == 0 and ExtDBupdate:
            if ExtDBupdate:
                ext_res,ext_errno,ext_why =  ESSMSSQL.DB().action('IngestObjectMetadata','INS',('ObjectIdentifierValue',ObjectIdentifierValue,
                                                                                    'ObjectMetadataType',ObjectMetadataType,
                                                                                    'ObjectMetadataServer',self.ftp_res[0],
                                                                                    'ObjectMetadataURL',self.ftp_res[1],