--- MPIWGWeb/MPIWGStaff.py 2008/10/22 11:27:42 1.10.2.62 +++ MPIWGWeb/MPIWGStaff.py 2009/09/30 16:56:00 1.10.2.70 @@ -35,17 +35,9 @@ def logger(txt,method,txt2): departmentList="Renn\nRheinberger\nDaston\nKlein\nSibum\nIT\nInstitut\nBibliothek" -def getTemplate(self, tpName): - """get a template file either form the instance or from the product""" - ext=self.ZopeFind(self.aq_parent,obj_ids=[tpName]) - if ext: - pt = getattr(self,ext[0][1].getId()) - else: - pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/'+tpName)).__of__(self) - assert(pt) - return pt -def createNewDBEntry(self,publish_the_data,key,name,vorname,title,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by="",e_mail2="",txt="",txt_p="no",stay_at_mpiwg="",group="",web_object_created="no",current_work=""): + +def createNewDBEntry(self,publish_the_data,key,name,vorname,titles_new,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by="",e_mail2="",txt="",txt_p="no",stay_at_mpiwg="",group="",web_object_created="no",current_work=""): """lege person in der datenbank an""" if date_to=="": # wenn date_to leer @@ -59,8 +51,8 @@ def createNewDBEntry(self,publish_the_da return False,"ERROR:key%s already exists"%key #eintragen - columnlist="""publish_the_data,key,last_name,first_name,title,status,e_mail,e_mail_p,date_from,date_to,department,home_inst,funded_by,e_mail2,date_stay_at_mpiwg,web_object_created,"group",current_work,current_work_p """ - insertTuple=(publish_the_data,key,name,vorname,title,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by,e_mail2,stay_at_mpiwg,web_object_created,group,current_work,"yes") + columnlist="""publish_the_data,key,last_name,first_name,titles_new,status,e_mail,e_mail_p,date_from,date_to,department,home_inst,funded_by,e_mail2,date_stay_at_mpiwg,web_object_created,"group",current_work,current_work_p """ + insertTuple=(publish_the_data,key,name,vorname,titles_new,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by,e_mail2,stay_at_mpiwg,web_object_created,group,current_work,"yes") insert=[] for element in insertTuple: @@ -107,6 +99,10 @@ class MPIWGStaff(CatalogAware,ZSQLExtend """get db_key utf8""" return utf8ify(self.getKey()) + def setKey(self,key): + """set key""" + self.key=key + def getKey(self): """get database key""" if hasattr(self,'key'): @@ -120,9 +116,12 @@ class MPIWGStaff(CatalogAware,ZSQLExtend def getConnectionObj(self): """returns connection id (from root)""" - root = self.getMPIWGRoot() - return root.getConnectionObj() - + try: + root = self.getMPIWGRoot() + return root.getConnectionObj() + except: + return self.en.getConnectionObj() + def isPublished(self): """gib publications status aus der datenbank aus""" key=self.getKey() @@ -341,7 +340,8 @@ class MPIWGStaff(CatalogAware,ZSQLExtend """harvest""" if not self.isPublished(): return "" - return getattr(self.en.staff.members,self.getId()).index_html() + st = getattr(self.en.staff.members,self.getId()).index_html() + return st def index_html(self): @@ -580,7 +580,7 @@ class MPIWGStaff(CatalogAware,ZSQLExtend """get the profile""" self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') - founds=self.ZSQLInlineSearchU(_table='personal_www',key=self.getKey()) + founds=self.ZSQLInlineSearchU(_table='personal_www',key=self.getKeyUTF8()) html="""%s""" if founds.profile and founds.profile != "": @@ -708,7 +708,7 @@ class MPIWGStaff(CatalogAware,ZSQLExtend pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMainData.zpt')).__of__(self) return pt() else: - self.ZSQLChange(argv,_table="personal_www",_identify="key=%s"%self.getKey(),USE_FORM="yes") + self.ZSQLChange(argv,_table="personal_www",_identify="lower(key)=%s"%utf8ify(self.getKey().lower()),USE_FORM="yes") if RESPONSE: self.redirect(RESPONSE,"editMainData")