Idea for a new "basic" class
During my process of discovering Zope, I have made quite a few products. I have allways found that there is a lot of repeated functionality and code just to get them up and running. I have an idea for a "basic" class to be added to the Zope framework that sets up the most comonly used mixin classes, and sets up sensible default values for them. So to make a very simple Zope product you just need to write:: from basic import basic class minimal(basic): meta_type = 'minimal' And it would set up a fully functional product with id, and title as default vales. manageAdd, manageAction, manage_editForm, manage_editAction, and index_html would also be included by default. If you want to add more properties you would just overwrite "_properties" from basic import basic class minimal(basic): meta_type = 'minimal' _properties=( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, {'id':'url', 'type':'string', 'mode':'w'}, {'id':'email', 'type':'string', 'mode':'w'}, ) And the manageAdd, manageAction, manage_editForm, manage_editAction, and index_html would change dynamically to fit the new properties. You could also add new methods, or overwrite the default ones like:: from basic import basic from global import DTMLFile class minimal(basic): meta_type = 'minimal' _properties=( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, {'id':'url', 'type':'string', 'mode':'w'}, {'id':'email', 'type':'string', 'mode':'w'}, ) index_html = DTMLFile('www/index_html', globals()) view = DTMLFile('www/view', globals()) edit = DTMLFile('www/edit', globals()) I believe that it would _greatly_ simplify the process of writing Python products. Taking the minimal needed code to get started from something like 40 lines to 3. Does it sound like a waste of time to write this class?? I think it would be fairly easy, but would anybody use it? And is it possible to get something like this into the core? If so I am willing to write it. regards Max M
On Tue, Jul 10, 2001 at 05:01:26PM +0200, Max Møller Rasmussen wrote: [...]
I have an idea for a "basic" class to be added to the Zope framework that sets up the most comonly used mixin classes, and sets up sensible default values for them.
[...] Two things. First, if you write this could it be made available as a "hotfix" product so even if it gets rolled into the core of a future release those of us who do not update at every release can easily apply this to whatever version we choose to use... Second, the idea looks good, and would look even better if you or someone else would be willing to write up a detailed how-to around it so newbies could grok the whys and wherefors and make productive use of it faster and easier... just my $0.02 -- charlie blanchard http://baldguru.com/ LosAngeles area Zope Users Group http://lazug.org
Well to be honest most of my products start from the same base. I cut and paste the folder, do a search replace with a new name and then I have new product. So yeah, this would be a nice idea. Cheers. -- Andy McKay. ----- Original Message ----- From: "Max Møller Rasmussen" <maxm@normik.dk> To: <zope@zope.org> Sent: Tuesday, July 10, 2001 8:01 AM Subject: [Zope] Idea for a new "basic" class
During my process of discovering Zope, I have made quite a few products. I have allways found that there is a lot of repeated functionality and code just to get them up and running.
I have an idea for a "basic" class to be added to the Zope framework that sets up the most comonly used mixin classes, and sets up sensible default values for them.
So to make a very simple Zope product you just need to write::
from basic import basic
class minimal(basic): meta_type = 'minimal'
And it would set up a fully functional product with id, and title as default vales. manageAdd, manageAction, manage_editForm, manage_editAction, and index_html would also be included by default.
If you want to add more properties you would just overwrite "_properties"
from basic import basic
class minimal(basic):
meta_type = 'minimal'
_properties=( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, {'id':'url', 'type':'string', 'mode':'w'}, {'id':'email', 'type':'string', 'mode':'w'}, )
And the manageAdd, manageAction, manage_editForm, manage_editAction, and index_html would change dynamically to fit the new properties.
You could also add new methods, or overwrite the default ones like::
from basic import basic from global import DTMLFile
class minimal(basic):
meta_type = 'minimal'
_properties=( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, {'id':'url', 'type':'string', 'mode':'w'}, {'id':'email', 'type':'string', 'mode':'w'}, )
index_html = DTMLFile('www/index_html', globals())
view = DTMLFile('www/view', globals())
edit = DTMLFile('www/edit', globals())
I believe that it would _greatly_ simplify the process of writing Python products. Taking the minimal needed code to get started from something like 40 lines to 3.
Does it sound like a waste of time to write this class?? I think it would be fairly easy, but would anybody use it? And is it possible to get something like this into the core? If so I am willing to write it.
regards Max M
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
ever looked at OFS.SimpleItem.SimpleItem? jens On Tuesday, July 10, 2001, at 05:01 , Max Møller Rasmussen wrote:
During my process of discovering Zope, I have made quite a few products. I have allways found that there is a lot of repeated functionality and code just to get them up and running.
I have an idea for a "basic" class to be added to the Zope framework that sets up the most comonly used mixin classes, and sets up sensible default values for them.
So to make a very simple Zope product you just need to write::
from basic import basic
class minimal(basic): meta_type = 'minimal'
And it would set up a fully functional product with id, and title as default vales. manageAdd, manageAction, manage_editForm, manage_editAction, and index_html would also be included by default.
If you want to add more properties you would just overwrite "_properties"
from basic import basic
class minimal(basic):
meta_type = 'minimal'
_properties=( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, {'id':'url', 'type':'string', 'mode':'w'}, {'id':'email', 'type':'string', 'mode':'w'}, )
And the manageAdd, manageAction, manage_editForm, manage_editAction, and index_html would change dynamically to fit the new properties.
You could also add new methods, or overwrite the default ones like::
from basic import basic from global import DTMLFile
class minimal(basic):
meta_type = 'minimal'
_properties=( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, {'id':'url', 'type':'string', 'mode':'w'}, {'id':'email', 'type':'string', 'mode':'w'}, )
index_html = DTMLFile('www/index_html', globals())
view = DTMLFile('www/view', globals())
edit = DTMLFile('www/edit', globals())
I believe that it would _greatly_ simplify the process of writing Python products. Taking the minimal needed code to get started from something like 40 lines to 3.
Does it sound like a waste of time to write this class?? I think it would be fairly easy, but would anybody use it? And is it possible to get something like this into the core? If so I am willing to write it.
regards Max M
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Jens Vagelpohl
ever looked at OFS.SimpleItem.SimpleItem?
Yes. Ever tried? from OFS import SimpleItem class minimal(SimpleItem.SimpleItem): meta_type ="minimal" And installing that under products? ;-) regards Max M Max M. W. Rasmussen, Denmark. New Media Director private: maxmcorp@worldonline.dk work: maxm@normik.dk ----------------------------------------------------- Shipping software is an unnatural act
Max Møller Rasmussen wrote:
During my process of discovering Zope, I have made quite a few products. I have allways found that there is a lot of repeated functionality and code just to get them up and running.
I have an idea for a "basic" class to be added to the Zope framework that sets up the most comonly used mixin classes, and sets up sensible default values for them.
So to make a very simple Zope product you just need to write::
from basic import basic
class minimal(basic): meta_type = 'minimal'
Perhaps this could be created as an "interface" class that has a bunch of inline documentation, but no guts. They seem to be sprouting up all over elsewhere in Zope... Reminds me of my Object Pascal days 8^)... -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Casey Duncan wrote:
Perhaps this could be created as an "interface" class that has a bunch of inline documentation, but no guts. They seem to be sprouting up all over elsewhere in Zope...
...welcome to the New Religion :-) Chris
It wouldn't need to be an interface, but instead it would need to implement some interfaces. Like: SimpleItem, PropertyManager and CatalogAware. regards Max M Max M. W. Rasmussen, Denmark. New Media Director private: maxmcorp@worldonline.dk work: maxm@normik.dk ----------------------------------------------------- Shipping software is an unnatural act
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chris Withers Sent: Tuesday, July 17, 2001 9:24 AM To: Casey Duncan Cc: Max Moller Rasmussen; 'zope@zope.org' Subject: Re: [Zope] Idea for a new "basic" class
Casey Duncan wrote:
Perhaps this could be created as an "interface" class that has a bunch of inline documentation, but no guts. They seem to be sprouting up all over elsewhere in Zope...
...welcome to the New Religion :-)
Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (7)
-
Andy McKay -
Casey Duncan -
Charlie Blanchard -
Chris Withers -
Jens Vagelpohl -
Max M -
Max Møller Rasmussen