version 1.17, 2007/01/08 17:57:23
|
version 1.18, 2007/01/09 17:01:01
|
Line 106 from ZODB.FileStorage import FileStorage
|
Line 106 from ZODB.FileStorage import FileStorage
|
class ECHO_cache: |
class ECHO_cache: |
def __init__(self): |
def __init__(self): |
"""init the storage""" |
"""init the storage""" |
done=False |
self.storage=FileStorage(os.path.join(INSTANCE_HOME,"var/echo_cache.fs")) |
i=0 |
|
while not done: |
|
try: |
|
self.storage=FileStorage("/var/tmp/echo_cache%s.fs"%i) |
|
done=True |
|
except: |
|
i+=1 |
|
|
|
self.db=DB(self.storage) |
self.db=DB(self.storage) |
self.connection=self.db.open() |
self.connection=self.db.open() |
self.root=self.connection.root() |
self.root=self.connection.root() |
Line 415 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
Line 407 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
|
|
|
|
|
|
def getPageLex(self,_pn="1",_id=None,_caching=None,_links=None,_showall="no"): |
def getPageLex(self,_pn="1",_id=None,_caching=None,_links=None,_showall="no",_displaylinks="yes"): |
"""getpage mit lexikalischer analyse und xslt transform |
"""getpage mit lexikalischer analyse und xslt transform |
if _caching=yes dann wird die lwxikalisch analysierte seite in einem cache abgespeichert |
if _caching=yes dann wird die lwxikalisch analysierte seite in einem cache abgespeichert |
""" |
""" |
Line 474 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
Line 466 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
xsltproc.appendStylesheet(stylesheet) |
xsltproc.appendStylesheet(stylesheet) |
tmp=xsltproc.run(document) |
tmp=xsltproc.run(document) |
|
|
if _links: |
if _links and (_displaylinks=='yes'): |
_links=urllib.unquote(_links) |
_links=urllib.unquote(_links) |
tmp=self.addLinks(tmp,url=_links) |
tmp=self.addLinks(tmp,url=_links) |
|
|
Line 522 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
Line 514 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
xmlt,self.baseUri=self.getTextInput() |
xmlt,self.baseUri=self.getTextInput() |
|
|
#get the text from cache, if existing |
#get the text from cache, if existing |
|
try: |
fromCache=self.cache.retrieveObject(self.baseUri,"-1") |
fromCache=self.cache.retrieveObject(self.baseUri,"-1") |
|
except: |
|
fromCache=None |
if fromCache and _caching=="yes": |
if fromCache and _caching=="yes": |
|
|
txt = fromCache |
txt = fromCache |
Line 558 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
Line 553 class ECHO_xslt(ECHO_pageTemplate,ECHO_l
|
else: |
else: |
k=len(idpb) |
k=len(idpb) |
#pn=k-1 #-1 wegen Seitenzahlzaehlung startet mit 0 |
#pn=k-1 #-1 wegen Seitenzahlzaehlung startet mit 0 |
pn=k #-1 wegen Seitenzahlzaehlung startet mit 0 |
pn=k-1 #-1 wegen Seitenzahlzaehlung startet mit 0 |
if pn > len(pbs): |
if pn > len(pbs): |
if REQUEST: |
if REQUEST: |
return "Sorry, pagenumber %s does not exit"%(pn+1) |
return "Sorry, pagenumber %s does not exit"%(pn+1) |
Line 640 def manage_addECHO_xslt(self, id, label,
|
Line 635 def manage_addECHO_xslt(self, id, label,
|
u = "%s/%s" % (u, quote(id)) |
u = "%s/%s" % (u, quote(id)) |
REQUEST.RESPONSE.redirect(u+'/manage_main') |
REQUEST.RESPONSE.redirect(u+'/manage_main') |
return '' |
return '' |
|
|