|
|
| version 1.1.2.10, 2010/02/10 18:25:44 | version 1.1.2.11, 2010/07/23 17:30:38 |
|---|---|
| Line 1 | Line 1 |
| from types import * | from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
| import logging | import logging |
| definedFields=['WEB_title','xdata_01','xdata_02','xdata_03','xdata_04','xdata_05','xdata_06','xdata_07','xdata_08','xdata_09','xdata_10','xdata_11','xdata_12','xdata_13','WEB_project_header','WEB_project_description','WEB_related_pub'] | definedFields=['WEB_title','xdata_01','xdata_02','xdata_03','xdata_04','xdata_05','xdata_06','xdata_07','xdata_08','xdata_09','xdata_10','xdata_11','xdata_12','xdata_13','WEB_project_header','WEB_project_description','WEB_related_pub'] |
| checkFields = ['xdata_01'] | checkFields = ['xdata_01'] |
| Line 20 def getTextFromNode(nodename): | Line 22 def getTextFromNode(nodename): |
| def getTemplate(self, tpName): | def getTemplate(self, tpName): |
| """get a template file either form the instance or from the product""" | """get a template file either form the instance or from the product""" |
| ext=self.ZopeFind(self.aq_parent,obj_ids=[tpName]) | #ext=self.ZopeFind(self.aq_parent,obj_ids=[tpName]) |
| if ext: | if hasattr(self,tpName): |
| pt = getattr(self,ext[0][1].getId()) | pt = getattr(self,tpName) |
| else: | else: |
| pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/'+tpName)).__of__(self) | pt=PageTemplateFile('zpt/'+tpName, globals()).__of__(self) |
| assert(pt) | assert(pt) |
| return pt | return pt |
| Line 86 def sortI(x,y): | Line 88 def sortI(x,y): |
| def unicodify(s): | def unicodify(s): |
| """decode str (utf-8 or latin-1 representation) into unicode object""" | """decode str (utf-8 or latin-1 representation) into unicode object""" |
| #logging.error("unicodify: %s"%str) | |
| if not s: | if not s: |
| return u"" | return u"" |
| if isinstance(s, str): | if isinstance(s, str): |
| Line 98 def unicodify(s): | Line 99 def unicodify(s): |
| return s | return s |
| def utf8ify(s): | def utf8ify(s): |
| """encode unicode object or string into byte string in utf-8 representation""" | """encode unicode object or string into byte string in utf-8 representation. |
| assumes string objects to be utf-8""" | |
| if not s: | if not s: |
| return "" | return "" |
| if isinstance(s, str): | if isinstance(s, str): |