[Plone-Users] Subclassing ATNewsItem

2 Messages Forum Options Options
Embed this topic
Permalink
Steve Hannah
[Plone-Users] Subclassing ATNewsItem
Reply Threaded MoreMore options
Print post
Permalink
Hi,

I would like to add some different image sizes to the image in  
ATNewsItem.  Someone on IRC suggested that the best way to do this is  
by subclassing ATNewsItem.   If I did it this way, it is important  
that my new type is a drop-in replacement for ATNewsItem so that all  
of the existing ATNewsItem objects in the site get converted to  
become objects of my custom NewsItem type and any part of the site  
that previously used ATNewsItems would know to use my custom type.  
(i.e. it should be seamless to the end user of the site).

I have created custom content types before but they have all been of  
the variety that shows up as a completely separate content type (i.e.  
they didn't replace existing content types).  I have read through the  
tutorial on RichDocument but I don't think that the examples there  
show how to replace the existing Document type with RichDocument - it  
just makes an additional RichDocument type available.

Can anyone offer some advice on how to accomplish this?

Thank you, and best regards


Steve Hannah
Web Services Developer

Faculty of Applied Sciences
Simon Fraser University
shannah@...
604-268-7228
Homepage: http://www.sjhannah.com
Creator of Dataface (http://fas.sfu.ca/dataface)




Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Martin Aspeli-2
Re: [Plone-Users] Subclassing ATNewsItem
Reply Threaded MoreMore options
Print post
Permalink
Steve Hannah wrote:

> Hi,
>
> I would like to add some different image sizes to the image in  
> ATNewsItem.  Someone on IRC suggested that the best way to do this is  
> by subclassing ATNewsItem.   If I did it this way, it is important  
> that my new type is a drop-in replacement for ATNewsItem so that all  
> of the existing ATNewsItem objects in the site get converted to  
> become objects of my custom NewsItem type and any part of the site  
> that previously used ATNewsItems would know to use my custom type.  
> (i.e. it should be seamless to the end user of the site).

You need to write migration for this. RichDocument tutorial covers how
to do this too.

> I have created custom content types before but they have all been of  
> the variety that shows up as a completely separate content type (i.e.  
> they didn't replace existing content types).  I have read through the  
> tutorial on RichDocument but I don't think that the examples there  
> show how to replace the existing Document type with RichDocument - it  
> just makes an additional RichDocument type available.

Which is what you should do. You can give it an archetype_name of 'News'
and then just diable global_allow for the standard News content type and
no-one will know the difference. You *could* do a full-on replacement,
i.e. have the same portal_type, like ATContentTypes migration does, but
trust me, it's almost certainly not worth the pain.

If you need to convert existing items, do a migration script.

Martin


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users