Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
- Made registration of browser views conditional
Browse files Browse the repository at this point in the history
- Move packages required for testing to 'test' extras

- Remove old zpkg-related SETUP.cfg file.

- Copyright "Zope Foundation and Contributors"
  • Loading branch information
fafhrd91 committed Dec 20, 2009
1 parent ee3ffb4 commit 3348840
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 96 deletions.
12 changes: 9 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
CHANGES
=======

Version 1.1.3 (unreleased)
Version 1.2.0 (12-19-2009)
--------------------------

-
- Made registration of browser views conditional

- Move packages required for testing to 'test' extras

Version 1.1.2 (2009-01-04)
- Remove old zpkg-related SETUP.cfg file.

- Copyright "Zope Foundation and Contributors"


Version 1.1.2 (01-04-2009)
--------------------------

- Added possibility to apply only specific named plugins in configure.
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
Expand Down
3 changes: 1 addition & 2 deletions importchecker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python2.4
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
Expand Down Expand Up @@ -351,4 +351,3 @@ def main():

if __name__ == '__main__':
main()

34 changes: 15 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def read(*rnames):

setup(
name = 'z3c.configurator',
version='1.1.3dev',
version='1.2.0dev',
author = "Zope Community",
author_email = "zope-dev@zope.org",
description = "Dynamic configuration",
Expand Down Expand Up @@ -55,27 +55,23 @@ def read(*rnames):
namespace_packages = ['z3c'],
extras_require = dict(
test = [
'zope.annotation',
'zope.dublincore',
'zope.formlib',
'zope.securitypolicy',
'zope.testbrowser',
'zope.testing',
'zope.app.pagetemplate',
'zope.app.testing',
'zope.app.zcmlfiles',
],
),
install_requires = [
'setuptools',
'zope.annotation',
'zope.app.pagetemplate',
'zope.app.securitypolicy',
'zope.app.testing',
'zope.app.zcmlfiles',
'zope.cachedescriptors',
'zope.component',
'zope.dublincore',
'zope.formlib',
'zope.i18nmessageid',
'zope.interface',
'zope.schema',
'zope.testbrowser',
'zope.testing',
],
dependency_links = ['http://download.zope.org/distribution'],
'setuptools',
'zope.component',
'zope.i18nmessageid',
'zope.interface',
'zope.schema',
],
zip_safe=False,
)

3 changes: 0 additions & 3 deletions src/z3c/configurator/SETUP.cfg

This file was deleted.

10 changes: 6 additions & 4 deletions src/z3c/configurator/browser/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns="http://namespaces.zope.org/browser"
i18n_domain="z3c.configurator">
xmlns:zope="http://namespaces.zope.org/zope"
xmlns="http://namespaces.zope.org/browser"
xmlns:zcml="http://namespaces.zope.org/zcml"
zcml:condition="installed zope.formlib"
i18n_domain="z3c.configurator">

<page
for="*"
Expand All @@ -11,4 +13,4 @@
class=".views.ConfigureForm"
menu="zmi_views"/>

</configure>
</configure>
53 changes: 24 additions & 29 deletions src/z3c/configurator/browser/ftesting.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,54 @@
<include package="zope.app.zcmlfiles" />

<include package="zope.securitypolicy" file="meta.zcml" />
<include package="zope.securitypolicy" />
<include package="zope.app.authentication" />
<securityPolicy
component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy" />

<include package="zope.app.securitypolicy" />
component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy" />

<role id="zope.Anonymous" title="Everybody"
description="All users have this role implicitly" />

<role id="zope.Manager" title="Site Manager" />


<principal
id="zope.manager"
title="Administrator"
login="mgr"
password="mgrpw" />
id="zope.manager"
title="Administrator"
login="mgr"
password="mgrpw" />

<grant
role="zope.Manager"
principal="zope.manager"
/>
role="zope.Manager"
principal="zope.manager" />

<unauthenticatedPrincipal
id="zope.anybody"
title="Unauthenticated User" />
id="zope.anybody"
title="Unauthenticated User" />

<unauthenticatedGroup
id="zope.Anybody"
title="Unauthenticated Users"
/>
id="zope.Anybody"
title="Unauthenticated Users" />

<authenticatedGroup
id="zope.Authenticated"
title="Authenticated Users"
/>
id="zope.Authenticated"
title="Authenticated Users" />

<everybodyGroup
id="zope.Everybody"
title="All Users"
/>
id="zope.Everybody"
title="All Users" />

<include package="zope.app.form.browser" />
<include package="zope.formlib" />
<include package="z3c.configurator"/>

<adapter
name="z3c.configurator.testing.settitle"
factory="z3c.configurator.browser.testing.SetTitle"/>

<adapter
name="z3c.configurator.testing.setdescription"
factory="z3c.configurator.browser.testing.SetDescription"/>

name="z3c.configurator.testing.settitle"
factory="z3c.configurator.browser.testing.SetTitle"/>

<adapter
name="z3c.configurator.testing.setdescription"
factory="z3c.configurator.browser.testing.SetDescription"/>

<grantAll role="zope.Manager" />

</configure>
6 changes: 2 additions & 4 deletions src/z3c/configurator/browser/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SetTitle(configurator.SchemaConfigurationPluginBase):
"""makes an object implement IFoo"""
component.adapts(IAttributeAnnotatable)
schema = ISingleArg

def __call__(self, data):
dc = IZopeDublinCore(self.context)
dc.title = data.get('arg')
Expand All @@ -24,9 +24,7 @@ class SetDescription(configurator.SchemaConfigurationPluginBase):

component.adapts(IAttributeAnnotatable)
schema = ISingleArg

def __call__(self, data):
dc = IZopeDublinCore(self.context)
dc.description = data.get('arg')


18 changes: 9 additions & 9 deletions src/z3c/configurator/browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from zope import formlib
from zope.formlib import form
from zope.app.pagetemplate import namedtemplate
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from z3c.configurator import interfaces
from z3c.configurator import interfaces
from z3c.configurator.i18n import _
from z3c.configurator import configurator

Expand All @@ -26,6 +26,7 @@ def selectPlugins(self, action, data):
configurator.configure(self.context, names=[pluginName])
self.status = _('Configuration applied')


class IGenerateSchema(interface.Interface):
"""Schema for the minimal generator parameters"""

Expand All @@ -43,7 +44,7 @@ class ConfigureForm(form.PageForm):
base_template = form.EditForm.template
template = ViewPageTemplateFile('configure.pt')
subforms = []

form_fields = form.Fields(
schema.List(__name__=u'pluginNames',
title=u'Plugin Names',
Expand All @@ -52,10 +53,10 @@ class ConfigureForm(form.PageForm):
title=_(u'Plugin Name'),
vocabulary="Configurator Plugin Names")
))

workDone = False

@Lazy
@property
def _pluginNames(self):
names = self.request.form.get(self.prefix + '.pluginNames')
if names and not type(names) is type([]):
Expand Down Expand Up @@ -87,7 +88,7 @@ def handleUpdate(self, action, data):
self.setUpWidgets(ignore_request=False)
result = self.template()
return result

def _pluginsSelected(self, action):
return not not self.request.form.get(self.prefix + '.pluginNames')

Expand All @@ -102,7 +103,7 @@ def handleApply(self, action, data):
subform.prefix,
formData)
configuratorData[subform.prefix] = formData

configurator.configure(self.context,
configuratorData,
names=self._pluginNames,
Expand All @@ -113,7 +114,7 @@ def handleApply(self, action, data):
class PluginSchemaForm(form.AddForm):
"""An editor for a single schema based plugin"""
interface.implements(formlib.interfaces.ISubPageForm)
template = formlib.namedtemplate.NamedTemplate('default')
template = namedtemplate.NamedTemplate('default')
actions = []

def __init__(self, context, request, plugin=None,
Expand All @@ -122,4 +123,3 @@ def __init__(self, context, request, plugin=None,
self.schema = schema
self.prefix = prefix
super(PluginSchemaForm, self).__init__(context, request)

4 changes: 2 additions & 2 deletions src/z3c/configurator/configurator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors.
# Copyright (c) 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
Expand Down Expand Up @@ -48,7 +48,7 @@ def requiredPlugins(component, names=[]):
# get all names we have available
names = getAdapterFactories(component,
specific=True).keys()

# we need this in order to get dependencies from plugins which are
# not available in the unconfigured component because the provided
# interfaces may change during execution
Expand Down
20 changes: 10 additions & 10 deletions src/z3c/configurator/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<configure
xmlns="http://namespaces.zope.org/zope"
i18n_domain="z3c.configurator">
xmlns="http://namespaces.zope.org/zope"
i18n_domain="z3c.configurator">

<permission
id="z3c.configurator.ManageConfigurations"
title="Manage Configurations"
/>
id="z3c.configurator.ManageConfigurations"
title="Manage Configurations"
/>

<utility
component=".vocabulary.pluginNamesVocabulary"
provides="zope.schema.interfaces.IVocabularyFactory"
name="Configurator Plugin Names"/>
component=".vocabulary.pluginNamesVocabulary"
provides="zope.schema.interfaces.IVocabularyFactory"
name="Configurator Plugin Names"/>

<include package=".browser"/>
</configure>

</configure>
1 change: 0 additions & 1 deletion src/z3c/configurator/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
import zope.i18nmessageid

_ = zope.i18nmessageid.MessageFactory('z3c.configurator')

3 changes: 2 additions & 1 deletion src/z3c/configurator/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors.
# Copyright (c) 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
Expand Down Expand Up @@ -43,6 +43,7 @@ def __call__(self, data):
then raise a ``DataMissingError`` error.
"""


class ISchemaConfigurationPlugin(IConfigurationPlugin):
"""A configuration plugin that provides a data schema."""

Expand Down
12 changes: 5 additions & 7 deletions src/z3c/configurator/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors.
# Copyright (c) 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
Expand All @@ -18,9 +18,7 @@
__docformat__ = "reStructuredText"
__docformat__ = 'restructuredtext'

import unittest
from zope.testing import doctest
from zope.testing.doctestunit import DocFileSuite
import unittest, doctest
from zope.app.testing import setup

def setUp(test):
Expand All @@ -32,9 +30,9 @@ def tearDown(test):

def test_suite():
return unittest.TestSuite((
DocFileSuite('README.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
doctest.DocFileSuite('README.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
),
))

Expand Down
Loading

0 comments on commit 3348840

Please sign in to comment.