Re: getting an object x in an external method that can be passed as context to ContentInit( ... ).initialize(context)
sureshvv <suresh_vv-/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
Enrique Pérez Arnaud wrote:
> I am trying to write a folderish Archetypes-based content type (by name
> of 'Almacen') that, on instantiation, will create a new content type on
> the fly. This creation starts from a mutator of a text field of the
> 'Almacen' content type, from which the new content type takes its name.
> The idea is to have its schema managed by the 'Almacen' instance, which
> inherits from SchemaEditor from ATSchemaEditorNG. I also want to be able
> to establish relations (from the Relations product) between different
> content types, so I cannot work on the lines of GenericPloneContent (I
> guess i need a fully fledged archetype.) What I am doing, is to create a
> class in the mutator with type.__new__(type, ... ), call registerType,
> and then call an external method that installs the new content type.
> The problem I am finding is getting an object (in the external method or
> in the mutator method) that can be passed as context to ContentInit( ...
> ).initialize(context), i.e., an object x that can do x.registerClass(...).
> I am using Zope-2.8.3 and Plone-2.1.1
>
You can say:
import Zope
root = Zope.app()
and get another Connection to the physical root of the site.
Just remember to say:
get_transaction().commit()
root._p_jar.close()
when you are finished, so you dont get conflict errors.
Suresh
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click