def statusTester(path): rec = DcsDataRecord(path=path) fmt = "%Y-%m-%dT%H:%M:%SZ" changeDate = time.strftime(fmt, time.gmtime()) statusNote = "Set status to Done" editor = "admin" rec.addStatusEntry(changeDate=changeDate, status="Done", statusNote=statusNote, editor=editor) print rec
def recordTester(path): dcsData = DcsDataRecord(path=path) element = dcsData.entriesElement element.setAttribute("recordId", dcsData.getId()) # print element.toxml() rec = Record(element) # parent = DIV() # rec.render(parent) # print parent print "\nrecordTeter" for child in rec.children: print "- %s (%s)" % (child.changeDate, child.timeStamp)
def update(self, recordID, setSpec): print "\nUpdating %s" % recordID path = os.path.join(self.dcs_data_dir, recordID + ".xml") dcs_data_rec = DcsDataRecord(path=path) ndrInfo = dcs_data_rec.getNdrInfo() dcs_data_rec.setSetSpec(setSpec) # print ndrInfo.toxml() if 1: print dcs_data_rec else: dcs_data_rec.write() print 'wrote %s' % recordID
def updateRecord(path): rec = DcsDataRecord(path=path) fmt = "%Y-%m-%dT%H:%M:%SZ" changeDate = time.strftime(fmt, time.gmtime()) statusNote = "Set status to Done" editor = "admin" rec.addStatusEntry(changeDate=changeDate, status="Done", statusNote=statusNote, editor=editor) if dowrites: rec.write() else: print 'would have written', os.path.basename(path)
def getDiskDcsDataRecord(recId): collectionKey = prefixMap[getPrefix(recId)] path = os.path.join(dscDataDir, collectionKey, recId + '.xml') return DcsDataRecord(path=path)
def _make_dcs_data_record (self): """ do not set last sync date! """ dcs_data = DcsDataRecord (path=self.dcs_data_template_path) dcs_data.setId (self.id) dcs_data.setNdrHandle (self.ndrHandle) dcs_data.addStatusEntry (status="Done", statusNote="Loaded from NDR", editor="Unknown", changeDate=self.timeStamp) current_status = dcs_data.getCurrentStatusEntry() dcs_data.setLastTouchDate (self.timeStamp) dcs_data.setLastEditor ("Unknown") return dcs_data
def __init__ (self, path): DcsDataRecord.__init__ (self, path=path)
def verify(self, recordID, setSpec): print "\nVerifying %s" % recordID path = os.path.join(self.dcs_data_dir, recordID + ".xml") dcs_data_rec = DcsDataRecord(path=path) assert dcs_data_rec.getSetSpec() == setSpec print "\tverified!"