Re: [Zope] Re: [Zope3-Users] Cannot view the instances after I refresh the product in ZMI
"Alex Cheng" <[email protected]> Wed, 28 Feb 2007 09:06:30 +0800
| Newsgroups | gmane.comp.web.zope.chinese,gmane.comp.web.zope.general |
|---|---|
| Message-ID | <[email protected]> |
Peter Bengtsson, you are right, my class is subclassing the product Folder,
because I need the features of Folder.
My code is followed:
from OFS.Folder import Folder
from Globals import DTMLFile
from Acquisition import Implicit
manage_addNewPageForm = DTMLFile("dtml/manage_addNewPageForm", globals())
def manage_addNewPage(self, id, note, REQUEST):
""" A method to create object
"""
newObject = MMPage(id, note)
self._setObject(id, newObject)
if REQUEST:
return self.manage_main(self, REQUEST)
class MMPage(Folder):
meta_type = "MM Page"
def __init__(self, id, note):
# Set private fields
self._note = note
self.PageData = {}
Folder.__init__(self, id)
#def index_html(self, Context = None, REQUEST = None):
def index_html(self, REQUEST = None):
""" render content to client
"""
# invoke onLoad method
if "onLoad" in self.objectIds("Script (Python)"):
self["onLoad"]()
# Render HTML
return self._render(REQUEST)
def _render(self, REQUEST):
""" Render HTML to browser
"""
self.page = self.getPageTemplate()
return self.page(REQUEST, **self.PageData)
def getPageTemplate(self):
return DTMLFile("/home/alex/zope2/Products/MMPage/dtml/template",
globals())
def sayLove(self):
"""
"""
return "How do I love thee? Let's count the ways---for testing3"
2007/2/28, Peter Bengtsson <peter-mMftuLXk/[email protected]>:
>
> You're most likely getting that error because your product is
> subclassing another product that has been refreshed.
> Suppose you do this in MyAProduct.py
>
> from Products.AnotherProduct.Foo import SomeClass
> class ThisProduct(SomeClass):
> bla bla bla
>
>
> If you refresh AnotherProduct, the MyAProduct will break and you'll get
> the error you mentioned.
>
>
> David Johnson wrote:
> > Paste the code here. :)
> >
> > On Feb 27, 2007, at 6:16 AM, Alex Cheng wrote:
> >
> >> Hello,
> >>
> >> I have modified my product code and click refresh in ZMI to update the
> >> product. Unfortunately when I view its instance in zope. The error
> >> message is follows:
> >>
> >> Error Type: TypeError
> >> Error Value: 'NoneType' object is not callable
> >>
> >> Could you help me?
> >>
> >> Thanks.
> >> --powered by python
> >> _______________________________________________
> >> Zope3-users mailing list
> >> [email protected]
> >> http://mail.zope.org/mailman/listinfo/zope3-users
> >
> > _______________________________________________
> > Zope maillist - [email protected]
> > http://mail.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -http://mail.zope.org/mailman/listinfo/zope-announce
> > http://mail.zope.org/mailman/listinfo/zope-dev )
> >
>
> --
> Peter Bengtsson,
> work www.fry-it.com
> home www.peterbe.com
> hobby www.issuetrackerproduct.com
>
--
powered by python
_______________________________________________
zope-chinese list
[email protected]
http://zope.cn/mailman/listinfo/zope-chinese