version 1.112, 2009/06/24 11:13:47
|
version 1.113, 2009/08/31 14:06:42
|
Line 801 class CDLIRoot(Folder):
|
Line 801 class CDLIRoot(Folder):
|
if isinstance(fileId,CDLIFileObject): # support for old baskets |
if isinstance(fileId,CDLIFileObject): # support for old baskets |
return fileId |
return fileId |
x=self.v_files.get(fileId) |
x=self.v_files.get(fileId) |
|
logging.debug("obj: "+repr(x)) |
|
if x==None: |
|
folder=fileId[0:3] |
|
f2=fileId[0:5] |
|
fObj = getattr(self.cdliRoot.cdli_main,folder); |
|
f2Obj = getattr(fObj,f2) |
|
|
|
o = getattr(f2Obj,fileId) |
|
logging.debug(o); |
|
self.updateOrAddToFileBTree(o) |
|
return o |
return x |
return x |
|
|
def getFileObjectLastVersion(self,fileId): |
def getFileObjectLastVersion(self,fileId): |
"""get an object""" |
"""get an object""" |
x=self.v_files_lastVersion.get(fileId) |
x=self.v_files_lastVersion.get(fileId) |
#logging.debug("lastVersion: "+repr(x)) |
logging.debug("lastVersion: "+repr(x)) |
|
if x==None: |
|
folder=fileId[0:3] |
|
f2=fileId[0:5] |
|
fObj = getattr(self.cdliRoot.cdli_main,folder); |
|
f2Obj = getattr(fObj,f2) |
|
|
|
o =getattr(f2Obj,fileId) |
|
logging.debug(o); |
|
return o.getLastVersion() |
|
|
|
|
return x |
return x |
|
|
def showFileIds(self): |
def showFileIds(self): |
Line 1349 class CDLIRoot(Folder):
|
Line 1370 class CDLIRoot(Folder):
|
try: |
try: |
self.cdliRoot.updateOrAddToFileBTree(ob[0].getObject()) |
self.cdliRoot.updateOrAddToFileBTree(ob[0].getObject()) |
except: |
except: |
|
|
logging.error("uploadATFfinally - cannot update Object %s Error: %s %s"%(ob[1],sys.exc_info()[0],sys.exc_info()[1])) |
logging.error("uploadATFfinally - cannot update Object %s Error: %s %s"%(ob[1],sys.exc_info()[0],sys.exc_info()[1])) |
|
for x in stObj.returnValue['newPs']: |
|
ob=self.CDLICatalog.search({'title':x}) |
|
try: |
|
self.cdliRoot.updateOrAddToFileBTree(ob[0].getObject()) |
|
except: |
|
|
|
logging.error("uploadATFfinally - cannot update Object %s Error: %s %s"%(x,sys.exc_info()[0],sys.exc_info()[1])) |
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect(self.absolute_url()) |
RESPONSE.redirect(self.absolute_url()) |
|
|
Line 1396 class CDLIRoot(Folder):
|
Line 1425 class CDLIRoot(Folder):
|
id=f |
id=f |
logging.debug("importFiles: addCDLIFile fobj2=%s, f=%s file2=%s"%(fobj2,repr(f),repr(file2))) |
logging.debug("importFiles: addCDLIFile fobj2=%s, f=%s file2=%s"%(fobj2,repr(f),repr(file2))) |
fobj2.addFile(vC='',file=file(file2),author=author,newName=f) |
fobj2.addFile(vC='',file=file(file2),author=author,newName=f) |
|
logging.debug("importfiles: fobj2.add") |
count+=1 |
count+=1 |
|
|
#now add the file to the storage |
#now add the file to the storage |
ob = getattr(fobj2,f) |
ob = getattr(fobj2,f) |
self.cdliRoot.updateOrAddToFileBTree(ob) |
logging.debug("importfiles: btree_start") |
|
#self.cdliRoot.updateOrAddToFileBTree(ob) |
|
logging.debug("importfiles: btree_end") |
if count%100==0: |
if count%100==0: |
logging.debug("importfiles: committing") |
logging.debug("importfiles: committing") |
transaction.get().commit() |
transaction.get().commit() |
|
|
|
logging.debug("importfiles: committing") |
transaction.get().commit() |
transaction.get().commit() |
|
logging.debug("importfiles: committing done") |
return "ok" |
return "ok" |
|
|
|
|