ciao,
ecco quello che ho fatto:
Ho definto l'interfaccia di configurazione del tool dichiarando un semplice
campo "front_end_links":
class ISmartLinkConfig(Interface):
front_end_links=schema.List(
title=u"Available Front-end links",
default=[u'Prova1',u'Prova2'],
value_type=schema.TextLine(),
unique=True,
required=False,
)
Poi ho definito il componente configlet: browser/configlet.py
class SmartlinkConfigForm(ControlPanelForm):
form_fields=form.Fields(ISmartLinkConfig)
label = _("Prova")
description = _("Prova")
form_name = _("Smartlink settings")
in browser/configure.zcml ho aggiunto:
<browser:page
for="Products.CMFPlone.Portal.PloneSite"
name="smartlink-config"
class=".configlet.SmartlinkConfigForm"
permission="cmf.ManagePortal"
/>
ho fornito l'utility locale in tool.py:
def rn_config_adapter(context):
return getUtility(ISmartLinkConfig,
name='smartlink-config',
context=context)
class SmartlinkConfig(SimpleItem):
implements(ISmartLinkConfig)
front_end_links=FieldProperty(ISmartLinkConfig['front_end_links'])
e l'ho registrato nel configure.zcml del pacchetto:
<adapter
for="Products.CMFPlone.Portal.PloneSite"
provides=".interfaces.ISmartLinkConfig"
factory=".tool.rn_config_adapter"
/>
In seguito ho creato profiles/defualt/componentregistry.xml:
<?xml version="1.0"?>
<componentregistry>
<utilities>
<utility name="smartlink-config"
factory="esempio.smartlink.tool.SmartlinkConfig"
interfaces="esempio.smartlink.interfaces.ISmartLinkConfig" />
</utilities>
</componentregistry>
e profiles/defualt/controlpanel.xml:
<?xml version="1.0"?>
<object name="portal_controlpanel" meta_type="Plone Control Panel Tool">
<configlet title="Smartlink" action_id="SmartlinkConfig"
appId="SmartlinkConfig" category="Products" condition_expr=""
url_expr="string:${portal_url}/smartlink-config"
visible="True">
<permission>Manage portal</permission>
</configlet>
</object>
Ho riavviato l'istanza e questa funziona. Il problema si presenta quando
reinstallo il prodotto.
Ottengo un errore di questo tipo:
...
Module Products.GenericSetup.tool, line 412, in runAllImportSteps
Module Products.GenericSetup.tool, line 390, in
runAllImportStepsFromProfile
Module Products.GenericSetup.tool, line 1182, in
_runImportStepsFromContext
Module Products.GenericSetup.tool, line 1093, in _doRunImportStep
- __traceback_info__: componentregistry
Module Products.GenericSetup.components, line 252, in
importComponentRegistry
Module Products.GenericSetup.utils, line 546, in _importBody
Module Products.GenericSetup.components, line 76, in _importNode
Module Products.GenericSetup.components, line 134, in _initUtilities
Module Products.GenericSetup.utils, line 112, in _resolveDottedName
- __traceback_info__:
ValueError: Empty module name
Il parametro "parts_copy" di "_resolveDottedName" per il tool SmartLink รจ:
['']
grazie dell'aiuto,
Federica
_______________________________________________
Plone-IT mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/plone-it
http://www.nabble.com/Plone---Italy-f21728.html