--- MPIWGWeb/MPIWGProjects.py 2005/10/13 18:00:36 1.47.2.29 +++ MPIWGWeb/MPIWGProjects.py 2005/12/22 21:09:00 1.47.2.44 @@ -4,6 +4,7 @@ for organizing and maintaining the diffe """ #TODO: mechanismus fur links to personen ueberarbeiten, da jetzt alle e_mails als members auftauchen unabhaengig vom status publish_the_data #TODO: was passiert wenn aenderungen von jochen im filemaker nicht mit den aenderungen im sql uebereinstimmen +#TODO: in einzelnen projecte steht als pfad auf die bilder noch wwwneu statt www from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate @@ -296,12 +297,12 @@ class MPIWGRoot(ZSQLExtendFolder): ids=[int(x.id[1:]) for x in founds] maximum=max(ids) - id_raw=self.ZSQLQuery("select nextval('id_raw_test')",debug=debug) + id_raw=self.ZSQLQuery("select nextval('id_raw')",debug=debug) if id_raw: - self.ZSQLQuery("drop sequence id_raw_test",debug=debug) + self.ZSQLQuery("drop sequence id_raw",debug=debug) - self.ZSQLQuery("create sequence id_raw_test start %i"%(maximum+1),debug=debug) + self.ZSQLQuery("create sequence id_raw start %i"%(maximum+1),debug=debug) def queryLink(self,link): @@ -536,7 +537,7 @@ class MPIWGRoot(ZSQLExtendFolder): list[urllib.quote(personNormal)]=(personNormal,[project[1]]) except: - zLOG.LOG("MPIWG Web (harvestHistoricalPerson)",zLOG.ERROR,"cannot annalyize: %s"%repr(project)) + zLOG.LOG("MPIWG Web (harvestHistoricalPerson)",zLOG.ERROR,"cannot analyize: %s"%repr(project)) return list @@ -700,10 +701,11 @@ class MPIWGRoot(ZSQLExtendFolder): manage_options = Folder.manage_options+( - {'label':'Update Personal Homepages','action':'updateHomepages'}, + {'label':'Update personal homepages','action':'updateHomepages'}, + {'label':'Reindex catalogs','action':'reindexCatalogs'}, {'label':'Main config','action':'changeMPIWGRootForm'}, - {'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, - {'label':'Store Historical Persons','action':'storeHistoricalPersons'}, + #{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, + #{'label':'Store Historical Persons','action':'storeHistoricalPersons'}, ) def importNamesForm(self): @@ -744,8 +746,9 @@ class MPIWGRoot(ZSQLExtendFolder): founds = self.ZSQLInlineSearch(_table="publications") for found in founds: - - if found.id_institutsbibliographie and (not found.id_institutsbibliographie ==""): + + if found.id_institutsbibliographie and (not found.id_institutsbibliographie =="") and (not found.id_institutsbibliographie =="0"): + entries = self.ZSQLInlineSearch(_table="institutsbiblio",id=found.id_institutsbibliographie) for entry in entries: self.ZSQLChange(_table='publications',_identify='oid=%s' % found.oid,year=entry.year,referencetype=entry.reference_type) @@ -757,14 +760,16 @@ class MPIWGRoot(ZSQLExtendFolder): return True - def updateHomepage_neu(self,RESPONSE=None): + def updateHomepages(self,RESPONSE=None): """ update""" + + RESPONSE.setHeader('Content-type', 'text/html') RESPONSE.write("
\n") - url="http://itgroup.mpiwg-berlin.mpg.de:8050/FMPro?-db=personal-www&-format=-dso_xml&-lay=sql_export&-max=10000&-findall" + url="http://itgroup.mpiwg-berlin.mpg.de:8050/FMPro?-db=personal-www&-format=-dso_xml&-lay=sql_export&-max=20000&-findall" dom = NonvalidatingReader.parseUri(url) #fh=urllib.urlopen(url) #dom=xml.dom.minidom.parse(fh) - + RESPONSE.write("got_xml_File\n") memberFolder=getattr(self,'members') @@ -782,6 +787,7 @@ class MPIWGRoot(ZSQLExtendFolder): name=getTextFromNode(row.xpath('./dn:Name',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) vorname=getTextFromNode(row.xpath('./dn:Vorname',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) title=getTextFromNode(row.xpath('./dn:Title',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) + position=getTextFromNode(row.xpath('./dn:Position',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) e_mail=getTextFromNode(row.xpath('./dn:e_mail',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) e_mail_p=getTextFromNode(row.xpath('./dn:e_mail_p',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) date_from=getTextFromNode(row.xpath('./dn:Date_from',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) @@ -791,7 +797,7 @@ class MPIWGRoot(ZSQLExtendFolder): funded_by=getTextFromNode(row.xpath('./dn:funded_by',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) e_mail2=getTextFromNode(row.xpath('./dn:e_mail2',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) publish_the_data=getTextFromNode(row.xpath('./dn:publish_the_data',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) - + stay_at_mpiwg=getTextFromNode(row.xpath('./dn:stay_at_mpiwg',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0]) #cwNode=row.xpath('./dn:current_work.current',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'})[0] cw=row.xpath('./dn:current_work/dn:DATA',explicitNss={'dn':'http://www.filemaker.com/fmpdsoresult'}) if cw: @@ -810,17 +816,18 @@ class MPIWGRoot(ZSQLExtendFolder): project=getattr(self,'members') if not (username in memberList):#neuer eintrag + try: - newObj=MPIWGStaff.MPIWGStaff(str(username),name,vorname) + newObj=MPIWGStaff.MPIWGStaff(str(username),name.encode('utf-8'),vorname.encode('utf-8')) memberFolder._setObject(str(username),newObj) RESPONSE.write("new:%s
\n"%username.encode('utf-8')) obj=getattr(memberFolder,username) ret=obj.createNewDBEntry(publish_the_data,id,name, - vorname,username,title,e_mail, + vorname,username,title,position,e_mail, e_mail_p,date_from,date_to, abteilung,heimat_inst,funded_by, e_mail2,txt,txt_p) - RESPONSE.write("""%s
"""%ret[1]) + RESPONSE.write("""%s
"""%ret[1].encode('utf-8')) except: RESPONSE.write("ERROR:%s %s %s
\n"%(username.encode('utf-8'),name.encode('utf-8'),vorname.encode('utf-8'))) RESPONSE.write(": %s %s"%sys.exc_info()[:2]) @@ -843,15 +850,52 @@ class MPIWGRoot(ZSQLExtendFolder): obj=getattr(memberFolder,username) - obj.updateDBEntry(DBid=id,publish_the_data=publish_the_data, + done= obj.updateDBEntry(DBid=id,publish_the_data=publish_the_data, date_from=date_from, - date_to=date_to) + date_to=date_to,stay_at_mpiwg=stay_at_mpiwg,position=position) + if not done and (publish_the_data=='yes'): + + ret=obj.createNewDBEntry(publish_the_data,id,name, + vorname,username,title,position,e_mail, + e_mail_p,date_from,date_to, + abteilung,heimat_inst,funded_by, + e_mail2,txt,txt_p) + if not ret[0]: - + RESPONSE.write("
Error: %s
\n"%repr(ret[1])) + else: + RESPONSE.write("New: %s
\n"%repr(ret[1])) + + #TODO: reindexCatlogs and updatePublications wieder einbaue + #self.reindexCatalogs(RESPONSE) + + #self.updatePublicationDB() + + self.ZSQLResetConnection() + RESPONSE.write("