[Zope] have problem with managing objects within a external
product
Allen Huang
swapp0 at yahoo.com
Mon Mar 12 02:29:35 EDT 2007
Hi.
I found out what my problem is.
in my code I please baseclass Item before Folder
class ShpProjectClass(Item, Folder, Persistent, Implicit, CatalogAware):
when I change the order, it worked normally
class ShpProjectClass(Folder, Item, Persistent, Implicit, CatalogAware):
but I don't understand why? could someone explain this to me?
----- Original Message ----
From: Allen Huang <swapp0 at yahoo.com>
To: Zope <zope at zope.org>
Sent: Monday, March 12, 2007 10:31:27 AM
Subject: Re: [Zope] have problem with managing objects within a external product
Dear AJ,
Thanks, but I still have some problems with creating a Folderish Object product
I imported Folder from OFS.Folder but I wasn't able to add any products like File, Folder, Image with in my folderish object.
my code looks like this-->
class ShpProjectClass(Item, Folder, Persistent, Implicit, CatalogAware):
id = 'ShpProject'
meta_type = 'ShpProject'
manage_options = (
{'label':'Contents', 'action':'manage_main'},
{'label':'Properties', 'action':'manage_editShpProjectForm'},
{'label':'View', 'action':'index_html'},
) + Item.manage_options
def __init__(self, id, projectDesc = 'Test Project'):
""" Initialize a ShpProject Object """
self.id = id
self.projectDesc = projectDesc
def getProjectInfo(self):
""" print a ShpProject Object Info """
return 'This project is called: ' + self.id + '. This project is about ' + self.projectName + '.'
def edit(self, projectDesc, REQUEST=None):
""" edit a ShpProject Object """
self.projectDesc = projectDesc
if REQUEST is not None:
return self.index_html(self, REQUEST)
##Web Methods
index_html = HTMLFile('DTML/index_html', globals())
manage_editShpProjectForm = HTMLFile('DTML/manage_editShpProjectForm', globals())
InitializeClass(ShpProjectClass)
what else am I missing? and is using ObjectManager unsave in anyway?
----- Original Message ----
From: Andreas Jung <lists at zopyx.com>
To: Allen Huang <swapp0 at yahoo.com>; Zope <zope at zope.org>
Sent: Friday, March 9, 2007 4:05:16 PM
Subject: Re: [Zope] have problem with managing objects within a external product
--On 9. März 2007 00:01:50 -0800 Allen Huang <swapp0 at yahoo.com> wrote:
> I made a simple product using python that stores some varibles, but I
> couldn't make it acts like a folderish, stores objects, and have a
> content tab page using manage_main like when I use to have when I use
> internal product.
>
> I reviewed the tutorials on how to make internal products and I found the
> base class modules ObjectManager and PropertySheets under OFS folder but
> I really ahve no idea how to use them.
>
> So it I want my product to act like an internally made product with
> baseclass ObjectManager, CatalogAware, and use propertysheets to manage
> my attributes and control what object type I want to store,
>
> would importing ObjectManager, PropertySheets, CatalogAware baseclass be
> enough?
For folderish content you derive from ObjectManager or for being on the
safe side from OFS.Folder
from OFS.Folder import Folder
class MyType(Folder):
meta_type= 'MyType'
.....
IntiializeClass(MyType)
-aj
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
_______________________________________________
Zope maillist - Zope at zope.org
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 )
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070311/4ec51e60/attachment.htm
More information about the Zope
mailing list