[Zope] Idea for a new "basic" class

Jens Vagelpohl jens@digicool.com
Tue, 10 Jul 2001 17:56:19 +0200


ever looked at OFS.SimpleItem.SimpleItem?

jens


On Tuesday, July 10, 2001, at 05:01 , Max M=F8ller 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 =3D 'minimal'
>
> And it would set up a fully functional product with id, and title as=20=

> 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 =3D 'minimal'
>
>         _properties=3D(
>             {'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 =3D 'minimal'
>
>         _properties=3D(
>             {'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 =3D DTMLFile('www/index_html', globals())
>
>         view =3D DTMLFile('www/view', globals())
>
>         edit =3D 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=20=

> like
> 40 lines to 3.
>
> Does it sound like a waste of time to write this class?? I think it =
would=20
> 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 )