version 1.64, 2007/02/05 16:20:38
|
version 1.65, 2007/02/08 10:46:36
|
Line 225 class uploadATFfinallyThread(Thread):
|
Line 225 class uploadATFfinallyThread(Thread):
|
i=0 |
i=0 |
transaction.get().commit() |
transaction.get().commit() |
logging.info("changing: do commit") |
logging.info("changing: do commit") |
|
|
transaction.get().commit() |
transaction.get().commit() |
logging.info("changing: last commit") |
logging.info("changing: last commit") |
|
|
Line 232 class uploadATFfinallyThread(Thread):
|
Line 233 class uploadATFfinallyThread(Thread):
|
newPs=SESSION['newPs'] |
newPs=SESSION['newPs'] |
if len(newPs)>0: |
if len(newPs)>0: |
tmpDir=SESSION['tmpdir'] |
tmpDir=SESSION['tmpdir'] |
|
logging.info("adding start") |
self.result="<p>Adding files</p>"+self.result |
self.result="<p>Adding files</p>"+self.result |
#TODO: make this configurable, at the moment base folder for the files has to be cdli_main |
#TODO: make this configurable, at the moment base folder for the files has to be cdli_main |
|
|
ctx2.importFiles(comment=comment,author=str(username) ,folderName=tmpDir, files=newPs,ext=self) |
ctx2.importFiles(comment=comment,author=str(username) ,folderName=tmpDir, files=newPs,ext=self) |
|
logging.info("adding finished") |
|
|
|
|
#unlock locked files? |
#unlock locked files? |
if unlock: |
if unlock: |
|
logging.info("unlocking start") |
self.result="<p>Unlock files</p>"+self.result |
self.result="<p>Unlock files</p>"+self.result |
unlockFns=[] |
unlockFns=[] |
for x in os.listdir(SESSION['tmpdir']): |
for x in os.listdir(SESSION['tmpdir']): |
if not x in SESSION['errors']: |
if not x in SESSION['errors']: |
unlockFns.append(x) |
unlockFns.append(x) |
|
logging.info("unlocking have now what to unlock") |
|
|
for fn in unlockFns: |
for fn in unlockFns: |
|
#logging.info("will unlock: %s"%fn) |
founds=ctx2.CDLICatalog.search({'title':fn}) |
founds=ctx2.CDLICatalog.search({'title':fn}) |
|
#logging.info("found it: %s"%repr(founds)) |
if len(founds)>0: |
if len(founds)>0: |
|
#logging.info("unlock: %s"%founds[0].getObject().getId()) |
SESSION['author']=str(username) |
SESSION['author']=str(username) |
|
|
founds[0].getObject().lockedBy="" |
founds[0].getObject().lockedBy="" |
|
logging.info("unlocking done") |
|
|
#if a basketname is give, add files to the basket |
#if a basketname is given, add files to the basket |
if not (basketname ==''): |
if not (basketname ==''): |
self.result="<p>Add basket</p>"+self.result |
logging.info("add to basket %s"%basketname) |
|
self.result="<p>Add to basket</p>"+self.result |
basketId=ctx2.basketContainer.getBasketIdfromName(basketname) |
basketId=ctx2.basketContainer.getBasketIdfromName(basketname) |
|
|
if not basketId: # create new basket |
if not basketId: # create new basket |
|
logging.info("create basket %s"%basketname) |
|
self.result="<p>Create a new basket</p>"+self.result |
ob=ctx2.basketContainer.addBasket(basketname) |
ob=ctx2.basketContainer.addBasket(basketname) |
basketId=ob.getId() |
basketId=ob.getId() |
basket=getattr(ctx2.basketContainer,str(basketId)) |
basket=getattr(ctx2.basketContainer,str(basketId)) |
Line 270 class uploadATFfinallyThread(Thread):
|
Line 281 class uploadATFfinallyThread(Thread):
|
RESPONSE.redirect(self.aq_parent.absolute_url()) |
RESPONSE.redirect(self.aq_parent.absolute_url()) |
|
|
|
|
|
logging.info("uploadfinally done") |
return True |
return True |
|
|
class tmpStore(SimpleItem): |
class tmpStore(SimpleItem): |
Line 832 class CDLIBasket(Folder,CatalogAware):
|
Line 843 class CDLIBasket(Folder,CatalogAware):
|
|
|
def addObjects(self,ids,deleteOld=None,username=None): |
def addObjects(self,ids,deleteOld=None,username=None): |
"""generate a new version of the basket with objects added""" |
"""generate a new version of the basket with objects added""" |
|
logging.info("add to basket (%s)"%(self.getId())) |
lastVersion=self.getLastVersion() |
lastVersion=self.getLastVersion() |
|
|
if lastVersion is None: |
if lastVersion is None: |
Line 850 class CDLIBasket(Folder,CatalogAware):
|
Line 861 class CDLIBasket(Folder,CatalogAware):
|
founds=self.CDLICatalog.search({'title':id}) |
founds=self.CDLICatalog.search({'title':id}) |
except: |
except: |
founds=[] |
founds=[] |
|
|
for found in founds: |
for found in founds: |
if found.getObject() not in oldContent: |
if found.getObject() not in oldContent: |
#TODO: was passiert wenn, man eine Object dazufgt, das schon da ist aber eine neuere version |
#TODO: was passiert wenn, man eine Object dazufgt, das schon da ist aber eine neuere version |
Line 863 class CDLIBasket(Folder,CatalogAware):
|
Line 875 class CDLIBasket(Folder,CatalogAware):
|
user = username |
user = username |
|
|
ob=manage_addCDLIBasketVersion(self,user,comment="",basketContent=content) |
ob=manage_addCDLIBasketVersion(self,user,comment="",basketContent=content) |
|
logging.info("add to basket (%s) done"%(self.getId())) |
return added |
return added |
|
|
|
|
Line 2152 class CDLIRoot(Folder):
|
Line 2164 class CDLIRoot(Folder):
|
obj=self.ZopeFind(root,obj_ids=[folder]) |
obj=self.ZopeFind(root,obj_ids=[folder]) |
if ext: |
if ext: |
|
|
ext.result+="<p>adding: %s </p>"%f |
ext.result="<p>adding: %s </p>"%f+ext.result |
if not obj: |
if not obj: |
manage_addCDLIFileFolder(root,folder,folder) |
manage_addCDLIFileFolder(root,folder,folder) |
fobj=getattr(root,folder) |
fobj=getattr(root,folder) |