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@zopyx.com> To: Allen Huang <swapp0@yahoo.com>; Zope <zope@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@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 ____________________________________________________________________________________ Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
participants (1)
-
Allen Huang