[Zope] Idea for a new "basic" class

Andy McKay andym@ActiveState.com
Tue, 10 Jul 2001 08:40:31 -0700


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=F8ller 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 co=
de
> just to get them up and running.
>
> I have an idea for a "basic" class to be added to the Zope framework th=
at
> sets up the most comonly used mixin classes, and sets up sensible defau=
lt
> 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
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 "_propertie=
s"
>
>     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, an=
d
> 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 Pytho=
n
> 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 wou=
ld
be
> fairly easy, but would anybody use it? And is it possible to get someth=
ing
> 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 )
>