Personal tools
Skip to content. | Skip to navigation
Dexterity behavior to add a local plone.app.registry for content types, it adds a local component with a layered proxy registry.
Dexterity behavior to enable a local Diazo theme. This package aims to make easier the creation of microsites on big web sites.
plone.multilingualbehavior adds multilingual behavior to content types built with Dexterity. It uses the next generation multilingual engine powered by five/Zope3 technologies, plone.multilingual. The behavior provides the Dexterity-driven content with a marker interface "ITranslatable", and makes available to that translation enabled type all the translation UI components such as menus, views, etc... To make your Dexterity content type translatable, add the following line to the <!-- enabled behaviors --> section in your type's profile: <!-- enabled behaviors --> <property name="behaviors"> <element value="plone.multilingualbehavior.interfaces.IDexterityTranslatable" /> </property> plone.multilingualbehavior implements language independent fields. The content of language independent fields is the same across all language versions. This is convenient, but also a little dangerous, because editing the field on any language version will change the content on all other language versions. For details on how to make fields language independent, see the examples in the test folder. tests/schemata.py shows how to make fields language independent when using the Grok framework; tests/samplecontent_type.xml shows how to achieve the same thing in an xml file. It is also possible to set a field to be language independent through the web, given a sufficiently new version of plone.schemaeditor.
NOT in development. This package is beeing merged on plone.app.multilingual .. image:: https://travis-ci.org/plone/plone.multilingual.png :target: http://travis-ci.org/plone/plone.multilingual plone.multilingual ================== This package contains the core functionality for the next generation multilingual engine. These are the main artifacts and its purposes: canonical: * the canonical organizes the information about a "translation-group" * it's using a dictionary with language-codes as keys and uuids (provided by plone.uuid) as values storage: * persistent storage, which holds the canonicals in an IOBTree * the OOBTree's key is the UUID of the content, the according value is the canonical manager: * adapter for ITranslatable * provides the translations API adapters: * ITranslationLocator - where to put a translation * ITranslationIdChooser - generates a valid id for a translation * ITranslationCloner - copy the language-independent content to the translation * ITranslationFactory - creates the translation In order to have a test we have a type called Demo that has an adapter called DemoLanguage that will allow to get the language of the object:: >>> from plone.multilingual.interfaces import ITranslationManager >>> from plone.multilingual.interfaces import ILanguage >>> from plone.app.testing import setRoles, login, TEST_USER_ID, TEST_USER_NAME >>> from zope.lifecycleevent import modified >>> portal = layer['portal'] >>> setRoles(portal, TEST_USER_ID, ['Manager']) >>> login(portal, TEST_USER_NAME) >>> portal.invokeFactory('Folder', 'ob1', title=u"An archetypes based folder") 'ob1' >>> ILanguage(portal['ob1']).set_language('ca') >>> portal['ob1'].reindexObject() >>> modified(portal['ob1']) Ensuring that the new object gets its UUID:: >>> from plone.uuid.interfaces import IUUID >>> ob1_uuid = IUUID(portal['ob1']) >>> isinstance(ob1_uuid, str) True We create a new translation in 'en' language:: >>> ITranslationManager(portal['ob1']).add_translation('en') We try to create a new translation in 'ca' that already exists:: >>> ITranslationManager(portal['ob1']).add_translation('ca') Traceback (most recent call last): ... KeyError: 'Translation already exists' We try to create a new translation without language:: >>> ITranslationManager(portal['ob1']).add_translation(None) Traceback (most recent call last): ... KeyError: 'There is no target language' We get the 'en' translation:: >>> ITranslationManager(portal['ob1']).get_translation('en') <ATFolder at /plone/ob1-en> >>> ILanguage(ITranslationManager(portal['ob1']).get_translation('en')).get_language() == 'en' True let's get all the translations:: >>> ITranslationManager(portal['ob1']).get_translations() {'ca': <ATFolder at /plone/ob1>, 'en': <ATFolder at /plone/ob1-en>} let's get only the languages:: >>> ITranslationManager(portal['ob1']).get_translated_languages() ['ca', 'en'] has_translation:: >>> ITranslationManager(portal['ob1']).has_translation('en') True >>> ITranslationManager(portal['ob1']).has_translation('it') False register_translation with invalid language:: >>> ITranslationManager(portal['ob1']).remove_translation('en') >>> ITranslationManager(portal['ob1']).register_translation(None, portal['ob1-en']) Traceback (most recent call last): ... KeyError: 'There is no target language' register a translation with content:: >>> ITranslationManager(portal['ob1']).register_translation('en', portal['ob1-en']) >>> ITranslationManager(portal['ob1']).get_translations() {'ca': <ATFolder at /plone/ob1>, 'en': <ATFolder at /plone/ob1-en>} changing the content-language (there should act a subscriber):: >>> ILanguage(portal['ob1-en']).set_language('it') >>> from zope.event import notify >>> from zope.lifecycleevent import ObjectModifiedEvent >>> notify(ObjectModifiedEvent(portal['ob1-en'])) >>> ITranslationManager(portal['ob1']).get_translations() {'ca': <ATFolder at /plone/ob1>, 'it': <ATFolder at /plone/ob1-en>} test more translations:: >>> obj_it = ITranslationManager(portal['ob1']).get_translation('it') >>> ITranslationManager(obj_it).add_translation('fr') >>> ITranslationManager(obj_it).add_translation('pt') >>> ITranslationManager(portal['ob1']).get_translated_languages() ['ca', 'it', 'fr', 'pt'] >>> ITranslationManager(obj_it).get_translated_languages() ['ca', 'it', 'fr', 'pt'] test if canonicals objects are the same:: >>> obj_ca = ITranslationManager(obj_it).get_translation('ca') >>> canonical_it = ITranslationManager(obj_it).query_canonical() >>> canonical_ca = ITranslationManager(obj_ca).query_canonical() >>> canonical_it == canonical_ca True Messing up with content ----------------------- In case that we do mess up things with content (users always do):: >>> from zope.lifecycleevent import modified >>> portal.invokeFactory('Folder', 'ob2', title=u"An archetypes based doc") 'ob2' >>> ILanguage(portal['ob2']).set_language('it') >>> modified(portal['ob2']) >>> ILanguage(portal['ob2']).get_language() 'it' >>> ITranslationManager(portal['ob2']).add_translation('en') >>> ob2_en = ITranslationManager(portal['ob2']).get_translation('en') >>> portal.invokeFactory('Folder', 'ob3', title=u"An archetypes based doc") 'ob3' >>> ILanguage(portal['ob3']).set_language('it') >>> modified(portal['ob3']) >>> ILanguage(portal['ob3']).get_language() 'it' >>> ITranslationManager(portal['ob3']).add_translation('es') >>> ob3_es = ITranslationManager(portal['ob3']).get_translation('es') >>> from OFS.event import ObjectWillBeRemovedEvent >>> notify(ObjectWillBeRemovedEvent(portal['ob2'])) >>> portal.manage_delObjects('ob2') >>> notify(ObjectWillBeRemovedEvent(ob3_es)) >>> portal.manage_delObjects(ob3_es.id) >>> c_old = ITranslationManager(portal['ob3']).query_canonical() >>> c_new = ITranslationManager(ob2_en).query_canonical() >>> c_old == c_new False >>> isinstance(c_old, str) True >>> isinstance(c_new, str) True >>> ITranslationManager(ob2_en).register_translation('it', portal['ob3']) >>> c1 = ITranslationManager(portal['ob3']).query_canonical() >>> c2 = ITranslationManager(ob2_en).query_canonical() >>> c1 == c2 True Other use case, A('it' + 'en') and B('it' + 'es'), and we want A('en') -> B('es'):: >>> portal.invokeFactory('Folder', 'mess1', title=u"An archetypes based doc") 'mess1' >>> ILanguage(portal['mess1']).set_language('it') >>> modified(portal['mess1']) >>> ILanguage(portal['mess1']).get_language() 'it' >>> ITranslationManager(portal['mess1']).add_translation('en') >>> mess1_en = ITranslationManager(portal['mess1']).get_translation('en') >>> portal.invokeFactory('Folder', 'mess2', title=u"An archetypes based doc") 'mess2' >>> ILanguage(portal['mess2']).set_language('it') >>> ITranslationManager(portal['mess2']).add_translation('es') >>> mess2_es = ITranslationManager(portal['mess2']).get_translation('es') >>> ITranslationManager(mess1_en).register_translation('es', mess2_es) >>> ITranslationManager(portal['mess2']).get_translation('es') >>> ITranslationManager(portal['mess1']).get_translation('es') <ATFolder at /plone/mess2-es> Default-Adapters ---------------- id-chooser:: >>> from plone.multilingual.interfaces import ITranslationIdChooser >>> chooser = ITranslationIdChooser(portal['ob1-en']) >>> chooser(portal, 'es') 'ob1-es' locator:: >>> ITranslationManager(portal['ob1']).add_translation('es') >>> child_id = portal.ob1.invokeFactory('Folder', 'ob1_child', language="ca") >>> from plone.multilingual.interfaces import ITranslationLocator >>> locator = ITranslationLocator(portal['ob1-en']) >>> locator('es') == portal True >>> child_locator = ITranslationLocator(portal.ob1.ob1_child) >>> child_locator('es') == portal['ob1-es'] True >>> ITranslationManager(portal['ob1']).remove_translation('es') Convert intids to uuids upgrade step ------------------------------------ An upgrade step is available in case of having an existing site with the experimental 0.1 plone.multilingual version:: >>> from plone.multilingual.upgrades.to02 import upgrade .. note:: You must reinstall the plone.multilingual package in order to install the required new utility in place before upgrading. If you are using a version of Dexterity below 2.0, you must install the package plone.app.referenceablebehavior and enable the *Referenceable* (plone.app.referenceablebehavior.referenceable.IReferenceable) behavior for all your Dexterity content types before you attempt to upgrade your site. You can run the @@pml-upgrade view at the root of your site or follow the upgrade step in portal_setup > upgrades. If you can't see the upgrade step, press *Show old upgrades* and select the *Convert translation based intids to uuids (0.1 → 02)* Upgrade to catalog ------------------ :: >>> from plone.multilingual.upgrades.to03 import upgrade we shouldn't find the storage-utility anymore:: >>> from plone.multilingual.interfaces import IMultilingualStorage >>> gsm = portal.getSiteManager() >>> gsm.queryUtility(IMultilingualStorage) is None True
This package provides a GUI for managing custom workflows in Plone. This is the successor of uwosh.northstar's workflow design tool (North* continues on as a file system product generator, given either a PloneFormGen or Dexterity prototype). Features * add/edit/delete new workflows * add content rule actions easily for a workflow transition * graph workflows * easily manipulate workflow permissions Graphing The package also supports graphing workflows. The inspiration for this piece was pretty much taken from DCWorkflowGraph. In order to enable this feature, you'll need to install the Graphviz library. Information can be found at http://www.graphviz.orga workflow manager for plone
The IVersionable behavior is used for enabling the CMFEditions functionality for dexterity contents. It adds a changeNote-field to the edit- and add-forms and creates a new version when the content is edited, if enabled for the content type. It's based on Products.CMFEditions. For listing the versions of an object use CMFEdtions' view versions_history_form or the history viewlet (see default @@view).
The IStagingSupport behavior is used for enabling the plone.app.iterate functionality for Dexterity content. It allows you to perform the checkout and checkin operations to work on a copy of your original content.
Introduction plone.app.contenttypes offers default content types for Plone based on Dexterity. This package replaces Products.ATContenttypes and will provide the default-types in Plone 5. It contains the following types: Folder Document News item File Image Link Event (Using behaviors from plone.app.event) Collection (this already replaces plone.app.collection which is no longer needed then) The main difference from a users perspective is that these types are extendable through-the-web. This means you can add or remove fields and behaviors using the control-panel "Dexterity Content Types" (/@@dexterity-types). The aim is to mimick the default-types as closely as possible. plone.app.contenttypes has been merged into the Plone 5.0 branch and will be shipped with the next Plone release: https://dev.plone.org/ticket/12344 Warning: Using plone.app.contenttypes on a site with existing content requires migrating the sites content. Please see the chapter "Migration". It can be used on a new site without problems. Compatibility Version 1.1b1 is tested with Plone 4.3.x. The versions 1.1.x will stay compatible with Plone 4.3.x. For support of Plone 4.1 and 4.2 please use version 1.0.x. Please note that they do not provide the full functionality. The future versions 1.2.x will be compatible with Plone 5 only and add support for plone.app.widgets Installation Add this line in the eggs section of your buildout.cfg eggs = ... plone.app.contenttypes If you have a Plone site with mixed Archetypes and Dexterity content use the extra requirement atrefs. eggs = ... plone.app.contenttypes [atrefs] This will also install the package plone.app.referenceablebehavior that allows you to reference dexterity-based content from archetypes-based content. You will have to enable the behavior plone.app.referenceablebehavior.referenceable.IReferenceable for all types that need to be referenced by Archetypes-content. What happens to existing content? If you install plone.app.contenttypes in a existing site all Archetypes-based content of the default types still exists and can be viewed but can't be edited. On installation plone.app.contenttypes removes the type-definitions for the old default-types like this: <object name="Document" remove="True" /> They are then replaced by new Definitions: <object meta_type="Dexterity FTI" name="Document" /> To make the existing content editable again you need to migrate it to Dexterity (please see the section on migration) or uninstall plone.app.contenttypes (see the section on uninstalling). Archetypes-based content provided by add-ons (e.g. Products.PloneFormGen) will still work since only the default-types are replaced. If you install plone.app.contenttypes on a fresh site (i.e. when no content has been edited or added) the usual default-content (Events, News, Members...) will be created as dexterity-content. Uninstalling To remove plone.app.contenttypes and return full functionality to old content and restore the AT-based default-types you have to install the import step "Types Tool" of the current base profile. Follow the following steps: in the ZMI navigate to portal_setup and the tab "import" in "Select Profile or Snapshot" leave "Current base profile (<Name of your Plonesite>)" selected. This is usually Products.CMFPlone select the Types Tool (usually Step 44) click "import selected steps" Any content you created based on plone.app.contenttypes will not be editable until you reinstall plone.app.contenttypes. Dependencies plone.app.dexterity >= 2.0.7. Dexterity is shipped with Plone 4.3.x. Version pinns for Dexterity are included in Plone 4.2.x. For Plone 4.1.x you need to pin the correct version for Dexterity in your buildout. See Installing Dexterity on older versions of Plone. plone.dexterity >= 2.2.1. Olders version of plone.dexterity break the rss-views because plone.app.contenttypes uses behaviors for the richtext-fields. plone.app.event >= 1.1b1. This provides the behaviors used for the event-type. plone.app.portlets >= 2.5a1. In older version the event-portlet will not work with the new event-type. These are the version-pinns for Plone 4.3.3: [buildout] versions = versions [versions] plone.app.event = 1.1b1 plone.app.portlets = 2.5a1 Plone-versions before 4.3.3 need to pinn more packages: [buildout] versions = versions [versions] plone.dexterity = 2.2.1 plone.app.dexterity = 2.0.11 plone.schemaeditor = 1.3.5 plone.app.event = 1.1b1 plone.app.portlets = 2.5a1 Migration To migrate your existing content from Archetypes to Dexterity use the form at /@@atct_migrator. For migrations to work you need at least Products.contentmigration = 2.1.3 (part of Plone since Plone 4.2.5) and plone.app.intid (part of Plone since Plone 4.1.0). Migrating Archetypes-based content to plone.app.contenttypes plone.app.contenttypes can migrate the following default types: Document Event File Folder Image Link News Item Collection The following non-default types will also be migrated: The AT-based Event-type provided by plone.app.event The DX-based Event-type provided by plone.app.event The Event-type provided by plone.app.contenttypes until version 1.0 News Items with blobs (provoded by https://github.com/plone/plone.app.blob/pull/2) Files and Images without blobs AT-based collection provided by plone.app.collection Migrations that might come in a future version: from ATTopic to Collections Please note that migrating versions of content is not supported. Only the current state of items is migrated without any content- or workflow-history. Migrating content that is translated with LinguaPlone Since LinguaPlone does not support Dexterity you need to migrate from LinguaPlone to plone.app.multilingual (http://pypi.python.org/pypi/plone.app.multilingual). The migration from Products.LinguaPlone to plone.app.multilingual should happen before the migration from Archetypes to plone.app.contenttypes. For details on the migration see http://pypi.python.org/pypi/plone.app.multilingual#linguaplone-migration Migrating from old versions of plone.app.contenttypes Before version 1.0a2 the content-items did not implement marker-interfaces. They will break in newer versions since the views are now registered for these interfaces (e.g. plone.app.contenttypes.interfaces.IDocument). To fix this you can call the view /@@fix_base_classes on your site-root. Since plone.app.contenttypes 1.1a1, the Collection type uses the new Collection behavior and the Event type utilizes behaviors from plone.app.event. In order to upgrade: First run the default profile (plone.app.contenttypes:default) or reinstall plone.app.contenttypes Then run the upgrade steps. Migrating default-content that was extended with archetypes.schemaextender The migration should warn you if any of your types are extended with archetypes.schemaextender. The data contained in these fields will be lost. You need to implement a custom migration for your types and dexterity-behaviors for the functionality provided by the schemaextenders. This is an advanced development task and beyond the scope of this documentation. Migrating custom content Custom content-types will not be touched by the migration plone.app.contenttypes and will continue to work as expeced. However if you'd like to migrate your content-types to Dexterity (you'll have to create these types in Dexterity first) you might want to have a look at the code of plone.app.contenttypes.migration.migration.NewsItemMigrator as a blueprint. Widgets When used in Plone 4.x plone.app.contenttypes uses the default z3c.form widgets. All widgets work as they used to with Archetypes except for the keywords-widget for which a simple linesfield is used. It is recommended to use plone.app.widgets to switch to the widgets that will be used in Plone 5. How to use with plone.app.widgets TODO How to override widgets To override the default keywords-widgets with a nicer widget you can use the package collective.z3cform.widgets. Add collective.z3cform.widgets to your buildout and in your own package register the override in your configure.zcml: <adapter factory=".subjects.SubjectsFieldWidget" /> Then add a file subjects.py from collective.z3cform.widgets.token_input_widget import TokenInputFieldWidget from plone.app.dexterity.behaviors.metadata import ICategorization from plone.app.z3cform.interfaces import IPloneFormLayer from z3c.form.interfaces import IFieldWidget from z3c.form.util import getSpecification from z3c.form.widget import FieldWidget from zope.component import adapter from zope.interface import implementer @adapter(getSpecification(ICategorization['subjects']), IPloneFormLayer) @implementer(IFieldWidget) def SubjectsFieldWidget(field, request): widget = FieldWidget(field, TokenInputFieldWidget(field, request)) return widget Once you install collective.z3cform.widgets in the quickinstaller, the new widget will then be used for all types. Information for Addon-Developers Design decicions The schemata for the types File, Image and Link are defined in xml-files using plone.supermodel. This allows the types to be editable trough the web. The types Document, News Item, Folder and Event have no schemata but only use behaviors to provide their fields. Installation as a dependency from another product If you want to add plone.app.contenttypes as a dependency from another products use the profile plone-content in your metadata.xml to have Plone populate a new site with DX-based default-content. <metadata> <version>1</version> <dependencies> <dependency>profile-plone.app.contenttypes:plone-content</dependency> </dependencies> </metadata> If you use the profile default then the default-content in new sites will still be Archetypes-based. You'll then have to migrate that content using the migration-form @@atct_migrator or delete it by hand. Extending the types You have several options: Extend the types through-the-web by adding new fields or behaviors in the types-controlpanel /@@dexterity-types. Extend the types with a custom type-profile that extends the existing profile with behaviors, or fields. You will first have to add the type to your [yourpackage]/profiles/default/types.xml. <?xml version="1.0"?> <object name="portal_types" meta_type="Plone Types Tool"> <object name="Folder" meta_type="Dexterity FTI" /> </object> Here is an example that enables the image-behavior for Folders in [yourpackage]/profiles/default/types/Folder.xml: <?xml version="1.0"?> <object name="Folder" meta_type="Dexterity FTI"> <property name="behaviors" purge="False"> <element value="plone.app.contenttypes.behaviors.leadimage.ILeadImage"/> </property> </object> By adding a schema-definition to the profile you can add fields. <?xml version="1.0"?> <object name="Folder" meta_type="Dexterity FTI"> <property name="model_file">your.package.content:folder.xml</property> <property name="behaviors" purge="False"> <element value="plone.app.contenttypes.behaviors.leadimage.ILeadImage"/> </property> </object> Put the schema-xml in your/package/content/folder.xml (the folder content needs a __init__.py) <model xmlns:security="http://namespaces.plone.org/supermodel/security" xmlns:marshal="http://namespaces.plone.org/supermodel/marshal" xmlns:form="http://namespaces.plone.org/supermodel/form" xmlns="http://namespaces.plone.org/supermodel/schema"> <schema> <field name="teaser_title" type="zope.schema.TextLine"> <description/> <required>False</required> <title>Teaser title</title> </field> <field name="teaser_subtitle" type="zope.schema.Text"> <description/> <required>False</required> <title>Teaser subtitle</title> </field> <field name="teaser_details" type="plone.app.textfield.RichText"> <description/> <required>False</required> <title>Teaser details</title> </field> </schema> </model> For more complex features you should create custom behaviors and/or write your own content-types. For more information on creating custom dexterity-types or custom behaviors to extend these types with read the dexterity documentation. Reordering fields provided by behaviors TODO Differences to Products.ATContentTypes The image of the News Item is not a field on the contenttype but a behavior that can add a image to any contenttypes (similar to http://pypi.python.org/pypi/collective.contentleadimage) All richtext-fields are also provided by a reuseable behavior. The functionality to transform (rotate and flip) images has been removed. There is no more field Location. If you need georeferenceable consider using collective.geo.behaviour The link on the image of the newsitem triggers an overlay The link-type now allows the of the variables ${navigation_root_url} and ${portal_url} to construct relative urls. The keywords-widget is not implemented and is replaced by a simple lines-widget unless you override it or use plone.app.widgets. Please see the section on widgets. Toubleshooting Please report issues in the bugtracker at https://github.com/plone/plone.app.contenttypes/issues. ValueError on installing When you try to install plone.app.contenttypes < 1.1a1 in a existing site you might get the following error: (...) Module Products.GenericSetup.utils, line 509, in _importBody Module Products.CMFCore.exportimport.typeinfo, line 60, in _importNode Module Products.GenericSetup.utils, line 730, in _initProperties ValueError: undefined property 'schema' Before installing plone.app.contenttypes you have to reinstall plone.app.collection to update collections to the version that uses Dexterity.
`EEA Depiction`_ (formerly valentine.imagescales) is a generic system for creating thumbnails/image representations for content types, both those provided by Plone, and custom ones. At the moment this system is implemented and tested only on Archetypes content types, however this system could be adapted in a later version to work also for dexterity content types. To make it work for a content type, three adapters need to be provided: 1. ImageView that retrieves an image in the desired scale. 2. ImageTag that returns the HTML tag for the image 3. ImageLink that returns the HTML link to the image.
This package provides the demo views for collective.z3cform.datagridfield. Examples of configurations are in the demo folder. Once you install this package, the demo views will be visible on your site. * http://localhost:8080/Plone/@@demo-collective.z3cform.datagrid