making polgroup location a setting

This commit is contained in:
Frédéric Péters 2011-08-09 19:01:54 +02:00
parent 70b670f1e3
commit bbf43a3ba1
6 changed files with 40 additions and 0 deletions

Binary file not shown.

View File

@ -16,6 +16,15 @@
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
<genericsetup:upgradeStep
title="Update registry"
source="*"
destination="1000"
handler=".upgrade.update_registry"
sortkey="1"
profile="tabellio.config:default"
/>
<browser:resource
name="tabellio.config.png"
image="icon.png"

View File

@ -67,6 +67,22 @@
</div>
<div
tal:define="error errors/polgroupsPath | nothing;
polgroupsPath python:request.get('polgroups', view.settings.polgroupsPath)"
tal:attributes="class python:'field error' if error else 'field'">
<label for="polgroupsPath" i18n:translate="label_polgroups_path">Political Groups</label>
<div tal:content="error" tal:condition="error" />
<input
name="polgroupsPath"
id="polgroupsPath"
type="text"
size="80"
tal:attributes="value polgroupsPath"
/>
</div>
<div class="formControls">
<input
type="submit"

View File

@ -45,10 +45,12 @@ class TabellioControlpanel(BrowserView):
deputies_path = form.get('deputiesPath')
documents_path = form.get('documentsPath')
polgroups_path = form.get('polgroupsPath')
if not self.errors:
self.settings.deputiesPath = deputies_path
self.settings.documentsPath = documents_path
self.settings.polgroupsPath = polgroups_path
if submitted and not self.errors:
self._setup()

View File

@ -15,3 +15,7 @@ class ITabellioSettings(Interface):
title=_('documents_path', 'Documents Path'),
required=False)
polgroupsPath = schema.TextLine(
title=_('polgroups_path', 'Political Groups Path'),
required=False)

View File

@ -0,0 +1,9 @@
from Products.CMFCore.utils import getToolByName
PROFILE_ID = "profile-tabellio.config:default"
def update_registry(context, logger=None):
# Run the registry.xml step as that may have defined new attributes
setup = getToolByName(context, 'portal_setup')
setup.runImportStepFromProfile(PROFILE_ID, 'plone.app.registry')