[Zope-PTK] Adding other types of news items

Jens Vagelpohl jens@digicool.com
Wed, 14 Feb 2001 22:41:44 -0500


scott,

from your description it sounds like you kept the property "Factory method
in product" the same and you did not actually create a new class on the file
system.

what is happening is that when you create an item of type "Market News" the
factory "addNewsItem" is still called, just like with the regular news item.
this will create an object of type NewsItem which has the meta type "News
Item".

simply copying the type in the Types Tool and renaming the meta type will
not create a new type of object by itself.

What you need to do is go to the PTKDemo directory in your zope install (on
the file system) and check out the NewsItem.py file. you would need to
create a new python class for your "Market News" object and give it a
distinct add method and meta type and all that, and then you can override
whatever is necessary in that new class. once you are done with that you
need to go back to the types tool and put the name of the add method into
the field "Factory method in product".

Make sure to add the correct product registration information for your
Market News object in the right places (like in __init__.py under PTKDemo),
just grep for NewsItem and emulate how it is being done.

jens


on 2/14/01 19:41, Scott Meilicke at meilicke@speakeasy.org wrote:

> Hello all,
> 
> I'd like to add a news item type that will only contain specific types of
> news,
> publishable by specific people.  In my case, I want to publish markting info,
> and present the option to add 'Market News' when the user clicks on 'New'
> within
> my stuff.  
> 
> via the manage interface, I went into portal_types, and copied the News Item
> to a Market Item. I then went to the properties of the Market Item and
> modified the meta type = Market Item instead of News Item.  However, when I
> add
> a Market Item, then look at the portal_catalog, it shows meta type still is
> equal to News Item, and of course the News Box picks it up.
> 
> Any thoughts?
> 
> I'm using a PTK from cvs, 02/12/2001 on NT4.
> 
> Thanks - Scott
> 
> Gravity.  It's not just a good idea.  It's the law.