Exemplo n.º 1
0
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
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
def getDiskDcsDataRecord(recId):
    collectionKey = prefixMap[getPrefix(recId)]
    path = os.path.join(dscDataDir, collectionKey, recId + '.xml')
    return DcsDataRecord(path=path)
Exemplo n.º 6
0
	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
Exemplo n.º 7
0
	def __init__ (self, path):
		DcsDataRecord.__init__ (self, path=path)
Exemplo n.º 8
0
 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!"