[Zope-CMF] Portal types q

James van der Veen james@codenamefuture.nl
Mon, 18 Jun 2001 16:34:00 +0200


Hey tres thanks!! It works great!!

Greetz,
James

-----Oorspronkelijk bericht-----
Van: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]Namens =
Tres
Seaver
Verzonden: maandag 18 juni 2001 15:55
Aan: James van der Veen
CC: zope-cmf@zope.org
Onderwerp: RE: [Zope-CMF] Portal types q


On Mon, 18 Jun 2001, James van der Veen wrote:

>=20
> >At DC, we have adopted a pattern in which we create an =
ExternalMethod,
> >to be run against a newly-created CMFSite, which does all the =
initial
> >configuration for a custom site.  In your case, it might delete all =
the
> >type objects except NewsItem, e.g.::
>=20
> >   def just_news( self )
> >       """
> >           We only want to add NewsItems on this site.
> >       """
> >       types =3D self.portal_types.listContentTypes()
> >       types.remove( 'News Item' )
> >       self.portal_types.manage_delObjects( types )
>=20
>=20
>=20
>=20
> >or something like that (in this case, it could even be a Python
> >Script, using 'context' in place of 'self').
>=20
> >Tres.
>=20
>=20
> So before I do something stupid (Isn=B4t rare ;) )
>=20
> I should first create a CMF and then run this External Method?

Right.  Suppose you create a CMFSite object, 'JustNews', in the
root of your Zope.  You would then create the PythonScript,
perhaps called 'make_just_news', also in the Zope root.  Make
its body::

  types =3D context.portal_types.listContentTypes()
  types.remove( 'News Item' )
  context.portal_types.manage_delObjects( types )

You would then invoke it on your site via URL::

  http://your.site.tld/JustNews/make_just_news

Presto! Change-o!  your site can only add News Items.

Tres.
--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org


_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://www.zope.org/Products/PTK/Tracker for bug reports and =
feature
requests