version 1.1.2.5, 2008/08/27 21:08:40
|
version 1.1.2.7, 2008/10/23 07:53:50
|
Line 18 def getTextFromNode(nodename):
|
Line 18 def getTextFromNode(nodename):
|
rc = rc + node.data |
rc = rc + node.data |
return rc |
return rc |
|
|
|
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 sortStopWordsF(self,xo,yo): |
def sortStopWordsF(self,xo,yo): |
if not hasattr(self,'_v_stopWords'): |
if not hasattr(self,'_v_stopWords'): |
Line 77 def sortI(x,y):
|
Line 86 def sortI(x,y):
|
|
|
def unicodify(str): |
def unicodify(str): |
"""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) |
#logging.error("unicodify: %s"%str) |
if not str: |
if not str: |
return "" |
return "" |
if type(str) is StringType: |
if type(str) is StringType: |
Line 97 def utf8ify(str):
|
Line 106 def utf8ify(str):
|
else: |
else: |
return str.encode('utf-8') |
return str.encode('utf-8') |
|
|
|
|
|
def shortenString(s, l, ellipsis='...'): |
|
"""returns a string of length l (or l-1) by omitting characters in the middle of s, replacing with ellipsis.""" |
|
l1 = int((l - len(ellipsis)) / 2) |
|
return "%s%s%s"%(s[:l1],ellipsis,s[-l1:]) |