[Zope] testing a product, then it disappears after restart

Tim Hicks tim.hicks@iname.com
Tue, 7 Nov 2000 01:10:11 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_00B1_01C04857.79E55080
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am trying to create a zope product and it basically works in python, =
so I thought I would start trying to 'zopify' it. I created a directory =
in the zope Products directory called zIMAP and placed my code in there, =
along with a __init__.py file to initialise the product. Here is what it =
looks like,

    import zIMAP

    def initialize(context):
        """Initialize the zIMAP product.
        """
        context.registerClass(
            zMAP.zimap,
            constructors =3D (zIMAP.manage_addzIMAPForm, =
zIMAP.manage_addzIMAP), icon =3D '')

The main bit of my product code is in a file called zIMAP.py. When I =
restarted zope, my zIMAP product appeared in the product management list =
(broken, as I'd expected). I looked at the debug info that zope provides =
for broken products and made some changes to the code... followed by =
restarting zope. I then got a different error from the broken product =
info screen. However, when I made changes to the code and restarted zope =
this time, it was as if I had done nothing. The same error was there =
(despite that particular line of code being different, and in fact at a =
different line). I could not make zope recognise my changes no matter =
how many times I restarted zope. So I tried deleting the product from =
the product management screen. It did indeed go away, but now it won't =
come back! When I delete any other working product, it simply reappears =
next time I restart zope. What has gone wrong with my product? How can I =
make zope recognise it again?

I have included the top of my zIMAP.py file as well in case it is =
required.

I'd really appreciate any help.

tim

top of zIMAP.py


import imaplib, re, string, sys, os, DocumentTemplate
import Globals
from Globals import Persistent, Acquisition
import AccessControl
import OFS

class zimap (
 Acquisition.Implicit,
 Persistent,
 AccessControl.Role.RoleManager,
 OFS.SimpleItem.Item,
 ):

 """zIMAP - Zope Product for displaying IMAP mailbox contents.
 """

 index_html =3D  DocumentTemplate.HTMLFile("zIMAP1.dtml")
 manage_addzIMAPForm =3D Globals.HTMLFile('add_zIMAP', globals())

 meta_type =3D 'zIMAP (webmail)'

 def __init__(self, host):
  self.host =3D host
  self.product_root =3D '.'

 class email:

  def connect(self, user, passw):
   self.user =3D user
   self.passw =3D passw
                 self.M =3D imaplib.IMAP4(self.host)
   self.M.login(self.user, self.passw)
   self.user_dir =3D zimap.product_root+'/spool/'+self.user
   email.makefiles(self)

...


------=_NextPart_000_00B1_01C04857.79E55080
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am trying to create a zope product =
and it=20
basically works in python, so I thought I would start trying to 'zopify' =
it. I=20
created a directory in the zope Products directory called zIMAP and =
placed my=20
code in there, along with a __init__.py file to initialise the product. =
Here is=20
what it looks like,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; import =
zIMAP</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; def=20
initialize(context):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
"""Initialize=20
the zIMAP=20
product.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"""<BR>&nbsp;=
&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp;=20
context.registerClass(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
zMAP.zimap,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;constructors=20
=3D (zIMAP.manage_addzIMAPForm,&nbsp;zIMAP.manage_addzIMAP),&nbsp;icon =
=3D=20
'')<BR></FONT><FONT face=3DArial size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The main bit of my product code is in a =
file called=20
zIMAP.py. When I restarted zope, my zIMAP product appeared in the =
product=20
management list (broken, as I'd expected). I looked at the debug info =
that zope=20
provides for broken products and made some changes to the code... =
followed by=20
restarting zope. I then got a different error from the broken product =
info=20
screen. However, when I made changes to the code and restarted zope this =
time,=20
it was as if&nbsp;I had done nothing. The same error was there (despite =
that=20
particular line of code being different, and in fact at a different =
line). I=20
could not make zope recognise my changes no matter how many times I =
restarted=20
zope. So I tried deleting the product from the product management =
screen. It did=20
indeed go away, but now it won't come back! When I delete any other =
working=20
product, it simply reappears next time I restart zope. What has gone =
wrong with=20
my product? How can I make zope recognise it again?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have included the top of my zIMAP.py =
file as well=20
in case it is required.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'd really appreciate any =
help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>tim</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>top of zIMAP.py</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>import imaplib, re, string, sys, os,=20
DocumentTemplate<BR>import Globals<BR>from Globals import Persistent,=20
Acquisition<BR>import AccessControl<BR>import OFS</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>class zimap=20
(<BR>&nbsp;Acquisition.Implicit,<BR>&nbsp;Persistent,<BR>&nbsp;AccessCont=
rol.Role.RoleManager,<BR>&nbsp;OFS.SimpleItem.Item,<BR>&nbsp;):</FONT></D=
IV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;"""zIMAP - Zope Product for =
displaying IMAP=20
mailbox contents.<BR>&nbsp;"""</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;index_html =3D&nbsp;=20
DocumentTemplate.HTMLFile("zIMAP1.dtml")<BR>&nbsp;manage_addzIMAPForm =
=3D=20
Globals.HTMLFile('add_zIMAP', globals())</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;meta_type =3D 'zIMAP =
(webmail)'</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;def __init__(self,=20
host):<BR>&nbsp;&nbsp;self.host =3D =
host<BR>&nbsp;&nbsp;self.product_root =3D=20
'.'</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;class email:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;def connect(self, user,=20
passw):<BR>&nbsp;&nbsp;&nbsp;self.user =3D =
user<BR>&nbsp;&nbsp;&nbsp;self.passw =3D=20
passw<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.M =3D=20
imaplib.IMAP4(self.host)<BR>&nbsp;&nbsp;&nbsp;self.M.login(self.user,=20
self.passw)<BR>&nbsp;&nbsp;&nbsp;self.user_dir =3D=20
zimap.product_root+'/spool/'+self.user<BR>&nbsp;&nbsp;&nbsp;email.makefil=
es(self)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>...</DIV></FONT>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_00B1_01C04857.79E55080--