catalog aware not working.. help
I made a pyhon product with catalogaware as one of my base class but my zcatalog named 'catalog' doesn't automatically catalog when I add a product item. what could be a problem? Please help this is part of my code that include catalogawareness: class ShpTypePointClass(Item, Persistent, Implicit, CatalogAware): # print "ShpTypePointClass" id='ShpTypePoint' meta_type='ShpTypePoint' manage_options = ( { 'label':'Properties','action':'manage_editShpTypePoint' }, ) + Item.manage_options #_properties=( # { 'id':'title', 'type':'string', 'mode':'w'}, # { 'id':'x', 'type':'string', 'mode':'w'}, # { 'id':'y', 'type':'string', 'mode':'w'} # ) def __init__(self, id, x, y, dbfInfo): # print 'initializing' self.id = id self.x = x self.y = y self.dbfInfo = dbfInfo self.reindex_object() def printPoint(self): # print "print Point" return "<br> printPoint Method <br> ID:" + self.id + " -- ( " + self.x + ", " + self.y + " )" def edit(self, x, y, REQUEST=None): """Edit the Point""" # print "edit" self.x = x self.y = y self.reindex_object() if REQUEST is not None: return self.manage_editShpTypePoint(self, REQUEST) ##Web Methods index_html = HTMLFile('DTML/index_html', globals()) manage_editShpTypePoint = HTMLFile('DTML/manage_editShpTypePoint', globals()) InitializeClass(ShpTypePointClass) ____________________________________________________________________________________ Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097
Hi Allen
I made a pyhon product with catalogaware as one of my base class but my zcatalog named 'catalog' doesn't automatically catalog when I add a product item. what could be a problem? Perhaps setting the catalog in your object instance may help:
self.manage_editCataloger(catalogPath) You may also try to change the way you are sub classing. In my case, I put CatalogAware as the first sub class (left-most). Regards Josef
(Tue, Mar 20, 2007 at 08:51:24AM +0100) Josef Meile wrote/schrieb/egrapse:
You may also try to change the way you are sub classing. In my case, I put CatalogAware as the first sub class (left-most).
Keep in mind that you really should be using CatalogPathAware not CatalogAware, or you will run into trouble with absolute_url() and virtual hosting. Regards, Sascha
Hi,
Keep in mind that you really should be using CatalogPathAware not CatalogAware, or you will run into trouble with absolute_url() and virtual hosting. Does it make a difference? If you go to <Zope_home>/lib/python/Products/ZCatalog/CatalogPathAwareness.py
You will see that CatalogPathAwareness.CatalogPathAware is a subclass of CatalogPathAwareness.CatalogAware with no code at all. I'm in deed using CatalogAware as base class of a python product in a virtual hosting environment and haven't noticed any problem.
(Wed, Mar 21, 2007 at 03:23:13PM +0100) Josef Meile wrote/schrieb/egrapse:
Keep in mind that you really should be using CatalogPathAware not CatalogAware, or you will run into trouble with absolute_url() and virtual hosting. Does it make a difference? If you go to <Zope_home>/lib/python/Products/ZCatalog/CatalogPathAwareness.py
You will see that CatalogPathAwareness.CatalogPathAware is a subclass of CatalogPathAwareness.CatalogAware with no code at all. I'm in deed using CatalogAware as base class of a python product in a virtual hosting environment and haven't noticed any problem.
I would assume that CatalogPathAwareness.CatalogAware and CatalogAwareness.CatalogAware aren't the same thing. Also there is a note at the start of lib/python/Products/ZCatalog/CatalogAwareness.py : "**NOTE**: This module is deprecated, and should only be used for backward-compatibility. All new code should use CatalogPathAwareness." Yes, I've experienced problems when basing objects only on "CatalogAware": When http://localhost:8080/example_site and http://www.example.org are really the same thing (one through virtual hosting and rewriting) and when you reindex objects while being at http://localhost:8080/example_site, then you will get surprising object URLs in your catalog - pointing back to the site URL you used while indexing. Usually it's not much of a problem to change existing objects over to CatalogPathAware. It might work to use from Products.ZCatalog.CatalogPathAwareness import CatalogAware - I don't know. But it's not the same as using "CatalogAware", which usually stems from people following really old documentation and using "CatalogPathAware would make it clear what's intended. All this is probably documented somewhere. Regards, Sascha
----- Original Message ----- From: "Allen Huang" <swapp0@yahoo.com> To: "Zope" <zope@zope.org> Sent: Tuesday, March 20, 2007 3:09 AM Subject: [Zope] catalog aware not working.. help
I made a pyhon product with catalogaware as one of my base class but my zcatalog named 'catalog' doesn't automatically catalog when I add a product item. what could be a problem?
I am not sure if this is your problem, but I have a vague recollection that the ZCatalog needs to be named 'Catalog' (initial capital). Jonathan
On 3/20/07, Allen Huang <swapp0@yahoo.com> wrote:
I made a pyhon product with catalogaware as one of my base class but my zcatalog named 'catalog' doesn't automatically catalog when I add a product item. what could be a problem?
Please help
this is part of my code that include catalogawareness:
class ShpTypePointClass(Item, Persistent, Implicit, CatalogAware):
iirc, CatalogAware has to first like so: class ShpTypePointClass( CatalogAware, Item, Persistent, Implicit): hth
# print "ShpTypePointClass" id='ShpTypePoint' meta_type='ShpTypePoint' manage_options = ( { 'label':'Properties','action':'manage_editShpTypePoint' }, ) + Item.manage_options
#_properties=( # { 'id':'title', 'type':'string', 'mode':'w'}, # { 'id':'x', 'type':'string', 'mode':'w'}, # { 'id':'y', 'type':'string', 'mode':'w'} # )
def __init__(self, id, x, y, dbfInfo): # print 'initializing' self.id = id self.x = x self.y = y self.dbfInfo = dbfInfo self.reindex_object() def printPoint(self): # print "print Point" return "<br> printPoint Method <br> ID:" + self.id + " -- ( " + self.x + ", " + self.y + " )" def edit(self, x, y, REQUEST=None): """Edit the Point""" # print "edit" self.x = x self.y = y self.reindex_object() if REQUEST is not None: return self.manage_editShpTypePoint(self, REQUEST) ##Web Methods index_html = HTMLFile('DTML/index_html', globals()) manage_editShpTypePoint = HTMLFile('DTML/manage_editShpTypePoint', globals()) InitializeClass(ShpTypePointClass)
________________________________ We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. _______________________________________________ Zope maillist - Zope@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 )
-- http://myzope.kedai.com.my - my-zope org
participants (5)
-
Allen Huang -
Bakhtiar A Hamid -
Jonathan -
Josef Meile -
Sascha Welter