[Zope] Remove/Ignore <P> and other HTML tags

Zhi-Wei Lu zwlu at ucdavis.edu
Thu Sep 14 18:52:30 EDT 2006


I am a system administrator who maintains our Zope servers.  I don't  
know that much
about python or zope, just enough to upgrade and trouble shooting  
from time to time.
Of course, the developers who have developed the system are no longer  
here.

I try to move a site from Zope 2.7.4 (python 2.4) to a new server  
with Zope 2.9.4 (python 2.4.3),
after some struggle, I have fixed most of the problems, but one that  
I don't have much clue.  I hope
that expert here can shed some light for me.

Here are section of code that displays part the of some abstract
<dtml-let
     rand1="get_random_image()"
     cap1="get_folder_title(name=rand1)"
     text="get_abstract_sample(name=rand1)">
    <table cellpadding=0 cellspacing=0><tr>

The function get_abstract_sample
is here

for object in container.research.objectValues():
   a = object.getId()
   if (a == name):
     text = object.research_description_html.read()
   else:
      pass

text = str(text)

return text[0:400] + '...'

The above code work fine for the 2.7.4 server, but fails for 2.9.4  
server, it will
ask for authentication password for 2.9.4, no user/password combination
will work.  If I  modify it as follows (for 2.9.4 server)

for object in container.research.objectValues():
   a = object.getId()
   if (a == name):
     text = object.research_description_html

text = str(text)

return text[0:400] + '...'

Getting rid of read() for the 2.9.4 server solve the authentication  
problem and
display the web page but with some unpleasant
<P> and other HTML tags literally (It doesn't for the old 2.7.4 server).

I would love to hear suggestions and advices from this group to get  
rid of
the literal <P> and other HTML tags.  Thank you very much for your help.

Thank you very much for your attention.

Zhi-Wei Lu
Institue for Data Analysis and Visualization (IDAV)
UC Davis                     Phone:    (530) 752-0494
Davis, CA 95616        Fax:         (530) 752-8894




More information about the Zope mailing list