# HG changeset patch
# User casties
# Date 1367569007 -7200
# Node ID 64be5db08495f1958f356b3e402f59f8b099df8d
# Parent 04fb655633ef4c5c43cf55372af5ab7766e7a2fd
more cleaning projects.
diff -r 04fb655633ef -r 64be5db08495 MPIWGProjects.py
--- a/MPIWGProjects.py Thu May 02 18:32:01 2013 +0200
+++ b/MPIWGProjects.py Fri May 03 10:16:47 2013 +0200
@@ -316,6 +316,7 @@
editImagesForm = PageTemplateFile('zpt/project/edit_images', globals())
editPublicationsForm = PageTemplateFile('zpt/project/edit_publications', globals())
editAdditionalPublicationsForm = PageTemplateFile('zpt/project/pubman/change_publications', globals())
+ editAddAdditionalPublications = PageTemplateFile('zpt/project/pubman/add_publications', globals())
# management templates
loadNewFileForm = PageTemplateFile('zpt/project/manage_newfile', globals())
description_only_html = PageTemplateFile('zpt/project/description_only_html', globals())
@@ -1457,88 +1458,63 @@
def addPublicationsFromPubman(self,REQUEST):
"""addPublications from pubman"""
-
data=REQUEST.form
-
if data.get("method",None) is None:
- pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','add_publications.zpt')).__of__(self)
+ pt = self.editAddAdditionalPublications
return pt()
-
-
if data.get("method") == "search":
entries= self.mpiwgPubman.search(data)
- pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','add_publications.zpt')).__of__(self)
-
-
+ pt = self.editAddAdditionalPublications
return pt(values=entries)
-
-
if data.get("method") == "add":
-
- return self.addEntriesToPublicationList(data)
+ return self.addEntriesToAdditionalPublicationList(data)
#pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self)
- def addEntriesToPublicationList(self,data):
- """fuege eintrage aus data zur publications liste,
+ def addEntriesToAdditionalPublicationList(self,data):
+ """fuege eintrage aus data zur publications liste.
+
@param data Map mit escidocID --> value
value muss "add" sein damit hinzugefuegt wird"""
-
for key in data.keys():
-
if key.startswith('escidoc:'):
-
query="INSERT INTO pubmanbiblio_projects (key_main,escidocId) values (%s,%s)"
-
if data.get(key)=="add":
self.executeZSQL(query,[self.getId(),key])
-
-
- #selectedPublications = self.getSelectedPublications()
-
- #pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','change_publications.zpt')).__of__(self)
-
- #return pt()
if hasattr(self,'REQUEST'):
- return self.REQUEST.response.redirect("changePublications")
+ return self.REQUEST.response.redirect("changeAdditionalPublications")
+
- def changePublications(self,REQUEST):
+ def changeAdditionalPublications(self,REQUEST):
"""change published publications"""
-
data=REQUEST.form
-
if data.get("method","change"):
for key in data.keys():
splitted=key.split("__") #format escidoc_id__p fuer priority, nur escidocid
value=data[key]
if len(splitted)==1:
- self.deleteFromPublicationList(key);
+ self.deleteFromAdditionalPublicationList(key);
elif(splitted[1]) == "p":
- self.setPublicationPriority(splitted[0],value);
+ self.setAdditionalPublicationPriority(splitted[0],value);
pt = self.editAdditionalPublicationsForm
return pt()
+
- def deleteFromPublicationList(self,escidocid):
+ def deleteFromAdditionalPublicationList(self,escidocid):
"""Loessche publication with escidoc id from publication list"""
-
query ="DELETE FROM pubmanbiblio_projects WHERE escidocid=%s and key_main=%s"
-
self.executeZSQL(query,[escidocid,self.getId()]);
+
- def setPublicationPriority(self,escidocid,value):
-
+ def setAdditionalPublicationPriority(self,escidocid,value):
query="update pubmanbiblio_projects set priority=%s where escidocid=%s and key_main=%s"
-
try:
-
value = int(value)
self.executeZSQL(query,[value,escidocid,self.getId()]);
-
-
except:
logging.error("couldn't change:")
logging.error(escidocid)
@@ -1561,8 +1537,6 @@
return False
-
-
def manage_addMPIWGProjectForm(self):
"""form for adding the project"""
pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'addMPIWGProjectForm.zpt')).__of__(self)
@@ -1884,7 +1858,19 @@
# update related publications
#
for pub in project.getPublicationList():
- pub.hasLinkToBookPage()
+ if not pub.text:
+ msg = "%s: publication has no text: %s!\n"%(project.getId(), pub)
+ log += msg
+ logging.warn(msg)
+ if not pub.link:
+ msg = "%s: publication has no link either! Deleting: %s!\n"%(project.getId(), pub)
+ log += msg
+ logging.error(msg)
+ project.deletePublication(pub.getId())
+
+ else:
+ # hasLinkToBookPage updates the bookId
+ pub.hasLinkToBookPage()
#
# unicodify
@@ -1900,8 +1886,7 @@
fulllog += log
if RESPONSE is not None:
RESPONSE.write(log)
-
-
+
log += "\n DONE! updated %s projects!" % cnt
fulllog += log
if RESPONSE is not None:
@@ -1910,9 +1895,6 @@
else:
return fulllog
-
-
-
def manage_addMPIWGProjectFolderForm(self):
"""form for adding a MPIWGProjectFolder"""
diff -r 04fb655633ef -r 64be5db08495 zpt/project/pubman/add_publications.zpt
--- a/zpt/project/pubman/add_publications.zpt Thu May 02 18:32:01 2013 +0200
+++ b/zpt/project/pubman/add_publications.zpt Fri May 03 10:16:47 2013 +0200
@@ -2,38 +2,35 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-
-
-
-
+
-
-
+
+
diff -r 04fb655633ef -r 64be5db08495 zpt/project/pubman/change_publications.zpt
--- a/zpt/project/pubman/change_publications.zpt Thu May 02 18:32:01 2013 +0200
+++ b/zpt/project/pubman/change_publications.zpt Fri May 03 10:16:47 2013 +0200
@@ -2,29 +2,22 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-
-
-
-
-
-
+
+
+