modifying content types by editing the python script

classic Classic list List threaded Threaded
7 messages Options
kenneth-36 kenneth-36
Reply | Threaded
Open this post in threaded view
|

modifying content types by editing the python script

Hi,

I need to have some extra fields in the general document (page) template.
So I've added the new and extra fields by modifying the python script
document.py that you can find in the folder AtContentTypes/content. When I
edit a general document or page the new fields are shown. But in the view
mode the fields aren't visible. So the question is how and where can I
modify the view_template so that the fields are also visible in the view
mode.

Thnx!

Kenneth
(D020055 on the IRC-channel)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Wichert Akkerman Wichert Akkerman
Reply | Threaded
Open this post in threaded view
|

Re: modifying content types by editing the python script

Previously [hidden email] wrote:
> Hi,
>
> I need to have some extra fields in the general document (page) template.
> So I've added the new and extra fields by modifying the python script
> document.py that you can find in the folder AtContentTypes/content.

Don't do that: changing standard products will make future upgrades very
problematic and make it very hard to seperate your changes from standard
features, making maintenance a lot harder for you and almost impossible
for others.

Instead create product with your new type derived from the standard one
and use that to replace the standard portal type. There are examples for
doing that in the documentation area on plone.org

> When I edit a general document or page the new fields are shown. But
> in the view mode the fields aren't visible. So the question is how and
> where can I modify the view_template so that the fields are also
> visible in the view mode.

You have to modify the view template, see the templates in
Products/ATContentTypes/skins/ATContentTypes/ . You will need to copy
the standard template for your new type to your new product, rename it
and modify it.

Wichert.

--
Wichert Akkerman <[hidden email]>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
David Convent-2 David Convent-2
Reply | Threaded
Open this post in threaded view
|

Re: modifying content types by editing the python script


On 20 Mar 2007, at 13:33, Wichert Akkerman wrote:

> Previously [hidden email] wrote:
>> Hi,
>>
>> I need to have some extra fields in the general document (page)  
>> template.
>> So I've added the new and extra fields by modifying the python script
>> document.py that you can find in the folder AtContentTypes/content.
>
> Don't do that: changing standard products will make future upgrades  
> very
> problematic and make it very hard to seperate your changes from  
> standard
> features, making maintenance a lot harder for you and almost  
> impossible
> for others.
>
> Instead create product with your new type derived from the standard  
> one
> and use that to replace the standard portal type. There are  
> examples for
> doing that in the documentation area on plone.org

I strongly second wichert in that regard: modifying original code  
will make your future work a nightmare.
Imagine that someone else has to maintain your site at some times,  
and decides to upgrade core products…

The RichDocument tutorial is very good at teaching how to create a  
new type derived from a standard one.
Its chapter about migrations tells how to make existing objects in  
your portal become the new type you created.
>
>> [...]
>
> Wichert.

--
David
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
kenneth-36 kenneth-36
Reply | Threaded
Open this post in threaded view
|

Re: modifying content types by editing the pythonscript

Hi,

I understand the fact that it isn't a good idea to change the source code
of content types because it gives you a lot of problems with maintaining
and updating the website.
However I was wondering if this isn't a disadvantage of Plone. If you
consider that a website is changing, evolving every day...
For example : today I create a website in Plone with the standaard content
types. After a few weeks, months or years I decide that an image content
type should have an extra field with some extra info. Perhaps some info
about the autor or some extra explanation for the image. So in Plone it's
impossible to realise this because you need to create a new content type.
So all the old images can't have the extra field? And If you create a new
content type for images and you remove the old one (the orginal one) you
will loose all the images that are currently on the website.
I would like to know your thoughts, remarks about this.

Best regards

Kenneth

>
> On 20 Mar 2007, at 13:33, Wichert Akkerman wrote:
>
>> Previously kenneth wrote:
>>> Hi,
>>>
>>> I need to have some extra fields in the general document (page)
>>> template.
>>> So I've added the new and extra fields by modifying the python script
>>> document.py that you can find in the folder AtContentTypes/content.
>>
>> Don't do that: changing standard products will make future upgrades
>> very
>> problematic and make it very hard to seperate your changes from
>> standard
>> features, making maintenance a lot harder for you and almost
>> impossible
>> for others.
>>
>> Instead create product with your new type derived from the standard
>> one
>> and use that to replace the standard portal type. There are
>> examples for
>> doing that in the documentation area on plone.org
>
> I strongly second wichert in that regard: modifying original code
> will make your future work a nightmare.
> Imagine that someone else has to maintain your site at some times,
> and decides to upgrade core productsÂ…
>
> The RichDocument tutorial is very good at teaching how to create a
> new type derived from a standard one.
> Its chapter about migrations tells how to make existing objects in
> your portal become the new type you created.
>>
>>> [...]
>>
>> Wichert.
>
> --
> David
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
yuri-2 yuri-2
Reply | Threaded
Open this post in threaded view
|

Re: modifying content types by editing the pythonscript

[hidden email] wrote:

> Hi,
>
> I understand the fact that it isn't a good idea to change the source code
> of content types because it gives you a lot of problems with maintaining
> and updating the website.
> However I was wondering if this isn't a disadvantage of Plone. If you
> consider that a website is changing, evolving every day...
> For example : today I create a website in Plone with the standaard content
> types. After a few weeks, months or years I decide that an image content
> type should have an extra field with some extra info. Perhaps some info
> about the autor or some extra explanation for the image. So in Plone it's
> impossible to realise this because you need to create a new content type.
> So all the old images can't have the extra field?

 Just change the type of old images in the new type.

 Look in Archetype where is stored the Portal Type, then change it from
old_type (Es: image) in new_type. All the new fields should show up
magically, I think.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Wichert Akkerman Wichert Akkerman
Reply | Threaded
Open this post in threaded view
|

Re: modifying content types by editing the pythonscript

In reply to this post by kenneth-36
Previously [hidden email] wrote:

> Hi,
>
> I understand the fact that it isn't a good idea to change the source code
> of content types because it gives you a lot of problems with maintaining
> and updating the website.
> However I was wondering if this isn't a disadvantage of Plone. If you
> consider that a website is changing, evolving every day...
> For example : today I create a website in Plone with the standaard content
> types. After a few weeks, months or years I decide that an image content
> type should have an extra field with some extra info. Perhaps some info
> about the autor or some extra explanation for the image. So in Plone it's
> impossible to realise this because you need to create a new content type.
> So all the old images can't have the extra field? And If you create a new
> content type for images and you remove the old one (the orginal one) you
> will loose all the images that are currently on the website.

You can migrate the old images to the new type, see the RichDocument
tutorial for example. Or you can use something like ATSchemaEditorNG.

Wichert.

--
Wichert Akkerman <[hidden email]>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
David Convent-2 David Convent-2
Reply | Threaded
Open this post in threaded view
|

Re: modifying content types by editing the pythonscript

In reply to this post by kenneth-36

On 20 Mar 2007, at 14:59, [hidden email] wrote:

> Hi,
>
> I understand the fact that it isn't a good idea to change the  
> source code
> of content types because it gives you a lot of problems with  
> maintaining
> and updating the website.
> However I was wondering if this isn't a disadvantage of Plone. If you
> consider that a website is changing, evolving every day...
> For example : today I create a website in Plone with the standaard  
> content
> types. After a few weeks, months or years I decide that an image  
> content
> type should have an extra field with some extra info. Perhaps some  
> info
> about the autor or some extra explanation for the image. So in  
> Plone it's
> impossible to realise this because you need to create a new content  
> type.
> So all the old images can't have the extra field? And If you create  
> a new
> content type for images and you remove the old one (the orginal  
> one) you
> will loose all the images that are currently on the website.
> I would like to know your thoughts, remarks about this.
In my previous mail, I pointed you to the RichDocument tutorial and  
specifically to its migration chapter that adresses that issue.

Cheers,
David

>
> Best regards
>
> Kenneth
>>
>> On 20 Mar 2007, at 13:33, Wichert Akkerman wrote:
>>
>>> Previously kenneth wrote:
>>>> Hi,
>>>>
>>>> I need to have some extra fields in the general document (page)
>>>> template.
>>>> So I've added the new and extra fields by modifying the python  
>>>> script
>>>> document.py that you can find in the folder AtContentTypes/content.
>>>
>>> Don't do that: changing standard products will make future upgrades
>>> very
>>> problematic and make it very hard to seperate your changes from
>>> standard
>>> features, making maintenance a lot harder for you and almost
>>> impossible
>>> for others.
>>>
>>> Instead create product with your new type derived from the standard
>>> one
>>> and use that to replace the standard portal type. There are
>>> examples for
>>> doing that in the documentation area on plone.org
>>
>> I strongly second wichert in that regard: modifying original code
>> will make your future work a nightmare.
>> Imagine that someone else has to maintain your site at some times,
>> and decides to upgrade core products…
>>
>> The RichDocument tutorial is very good at teaching how to create a
>> new type derived from a standard one.
>> Its chapter about migrations tells how to make existing objects in
>> your portal become the new type you created.
>>>
>>>> [...]
>>>
>>> Wichert.
>>
>> --
>> David
>> ---------------------------------------------------------------------
>> ----
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to  
>> share
>> your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Plone-Users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/plone-users
>>
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users