|
/
Zope
/
gocept svn checkins
/
Archive
/
2007
/
2007-12
/
SVN: r5456 - gocept.countrywidget/trunk/src/gocept/countrywidget
[
SVN: r5455 - in gocept.countrywidget/trunk: . src ... ]
[
SVN: r5465 - Formulon/trunk / Michael Howitz ... ]
SVN: r5456 - gocept.countrywidget/trunk/src/gocept/countrywidget
Daniel Havlik <dh(at)gocept.com> |
2007-12-04 09:41:07 |
[ FULL ]
|
Author: nilo
Date: Tue Dec 4 09:41:04 2007
New Revision: 5456
Log:
removed demo type
Removed:
gocept.countrywidget/trunk/src/gocept/countrywidget/ATCWDemoType.py
Modified:
gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py
==============================================================================
--- gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py Tue Dec 4
09:41:04 2007
(at)(at) -9,7 +9,7 (at)(at)
from Products.validation import validation
# siblings
-from config import SKINS_DIR, GLOBALS, PROJECTNAME,
access_contents_information, INSTALL_DEMO_TYPE
+from config import SKINS_DIR, GLOBALS, PROJECTNAME,
access_contents_information
from validators import CountryValidator
registerDirectory(SKINS_DIR, GLOBALS)
(at)(at) -24,23 +24,6 (at)(at)
#validator
validation.register(CountryValidator('isValidISOCountry'))
- #demo-type
- if INSTALL_DEMO_TYPE:
- import ATCWDemoType
-
- content_types, constructors, ftis = process_types(
- listTypes(PROJECTNAME),
- PROJECTNAME)
-
- cmfcutils.ContentInit(
- PROJECTNAME + ' Content',
- content_types = content_types,
- permission = access_contents_information,
- extra_constructors = constructors,
- fti = ftis,
- ).initialize(context)
-
-
context.registerClass(
CountryTool.CountryUtils,
constructors=(CountryTool.manage_addCountryUtils,),
|
SVN: r5457 - gocept.countrywidget/trunk/src/gocept/countrywidget
Daniel Havlik <dh(at)gocept.com> |
2007-12-04 09:41:18 |
[ FULL ]
|
Author: nilo
Date: Tue Dec 4 09:41:17 2007
New Revision: 5457
Log:
removed makeRelease script
Removed:
gocept.countrywidget/trunk/src/gocept/countrywidget/makeRelease
|
SVN: r5458 - in gocept.countrywidget/trunk/src/gocept/countrywidget/skins: ATCountryWidget countrywidget
Daniel Havlik <dh(at)gocept.com> |
2007-12-04 09:52:32 |
[ FULL ]
|
Author: nilo
Date: Tue Dec 4 09:52:30 2007
New Revision: 5458
Log:
renamed skin layer
Added:
gocept.countrywidget/trunk/src/gocept/countrywidget/skins/countrywidget/
- copied from r5455,
gocept.countrywidget/trunk/src/gocept/countrywidget/skins/ATCountryWidget/
Removed:
gocept.countrywidget/trunk/src/gocept/countrywidget/skins/ATCountryWidget/
|
SVN: r5459 - in gocept.countrywidget/trunk/src/gocept/countrywidget: . profiles profiles/default
Daniel Havlik <dh(at)gocept.com> |
2007-12-04 09:59:30 |
[ FULL ]
|
Author: nilo
Date: Tue Dec 4 09:59:27 2007
New Revision: 5459
Log:
registering skin layer via zcml and genericsetup
Added:
gocept.countrywidget/trunk/src/gocept/countrywidget/configure.zcml
(contents, props changed)
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles.zcml
(contents, props changed)
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/default/
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/default/skins.xml
gocept.countrywidget/trunk/src/gocept/countrywidget/skins.zcml (contents,
props changed)
Modified:
gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py
gocept.countrywidget/trunk/src/gocept/countrywidget/config.py
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py
==============================================================================
--- gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py Tue Dec 4
09:59:27 2007
(at)(at) -9,11 +9,9 (at)(at)
from Products.validation import validation
# siblings
-from config import SKINS_DIR, GLOBALS, PROJECTNAME,
access_contents_information
+from config import access_contents_information
from validators import CountryValidator
-registerDirectory(SKINS_DIR, GLOBALS)
-
def initialize(context):
#tool
import CountryTool
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/config.py
==============================================================================
--- gocept.countrywidget/trunk/src/gocept/countrywidget/config.py (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/config.py Tue Dec 4
09:59:27 2007
(at)(at) -2,11 +2,6 (at)(at)
# See also LICENSE.txt
# $Id$
-PROJECTNAME = "ATCountryWidget"
-SKINS_DIR = 'skins'
-GLOBALS = globals()
-INSTALL_DEMO_TYPE = False
-
COUNTRIES = {
'AF':'Afghanistan',
'AL':'Albania',
Added: gocept.countrywidget/trunk/src/gocept/countrywidget/configure.zcml
==============================================================================
--- (empty file)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/configure.zcml Tue Dec
4 09:59:27 2007
(at)(at) -0,0 +1,10 (at)(at)
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="gocept.countrywidget">
+
+ <include package=".browser" />
+
+ <include file="skins.zcml" />
+ <include file="profiles.zcml" />
+
+</configure>
Added: gocept.countrywidget/trunk/src/gocept/countrywidget/profiles.zcml
==============================================================================
--- (empty file)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/profiles.zcml Tue Dec
4 09:59:27 2007
(at)(at) -0,0 +1,14 (at)(at)
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+ i18n_domain="gocept.countrywidget">
+
+ <genericsetup:registerProfile
+ name="default"
+ title="countrywidget setup"
+ directory="profiles/default"
+ description=''
+ provides="Products.GenericSetup.interfaces.EXTENSION"
+ />
+
+</configure>
Added:
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/default/skins.xml
==============================================================================
--- (empty file)
+++
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/default/skins.xml Tue
Dec 4 09:59:27 2007
(at)(at) -0,0 +1,13 (at)(at)
+<?xml version="1.0"?>
+<object name="portal_skins">
+
+ <object name="countrywidget"
+ meta_type="Filesystem Directory View"
+ directory="gocept.countrywidget:skins/countrywidget"/>
+
+ <skin-path name="Plone Default">
+ <layer name="countrywidget"
+ insert-after="custom"/>
+ </skin-path>
+
+</object>
Added: gocept.countrywidget/trunk/src/gocept/countrywidget/skins.zcml
==============================================================================
--- (empty file)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/skins.zcml Tue Dec 4
09:59:27 2007
(at)(at) -0,0 +1,9 (at)(at)
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:cmf="http://namespaces.zope.org/cmf"
+ i18n_domain="gocept.countrywidget">
+
+ <!-- File System Directory Views registration -->
+ <cmf:registerDirectory
+ name="countrywidget"/>
+</configure>
|
SVN: r5460 - gocept.countrywidget/trunk/src/gocept/countrywidget
Daniel Havlik <dh(at)gocept.com> |
2007-12-04 11:00:18 |
[ FULL ]
|
Author: nilo
Date: Tue Dec 4 11:00:13 2007
New Revision: 5460
Log:
- renamed tool and interfaces
- removed zmi code out of tool
Added:
gocept.countrywidget/trunk/src/gocept/countrywidget/countryutility.py
(contents, props changed)
gocept.countrywidget/trunk/src/gocept/countrywidget/interfaces.py
Removed:
gocept.countrywidget/trunk/src/gocept/countrywidget/CountryTool.py
gocept.countrywidget/trunk/src/gocept/countrywidget/Interfaces.py
Added: gocept.countrywidget/trunk/src/gocept/countrywidget/countryutility.py
==============================================================================
--- (empty file)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/countryutility.py Tue
Dec 4 11:00:13 2007
(at)(at) -0,0 +1,321 (at)(at)
+# Copyright (c) 2004 gocept. All rights reserved.
+# See also LICENSE.txt
+# $Id$
+
+# Zope imports
+from AccessControl import ClassSecurityInfo
+from OFS.SimpleItem import SimpleItem
+from Globals import InitializeClass
+
+# Zope Products imports
+from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from Products.CMFCore.utils import UniqueObject
+
+# Siblings
+from Interfaces import ICountry, IArea, ICountryUtils
+from config import access_contents_information, manage_properties, COUNTRIES
+
+class Country(object):
+
+ __allow_access_to_unprotected_subobjects__ = 1
+ __implements__ = (ICountry, )
+
+ isocc = None
+ name = None
+
+ def __init__(self, isocc, name=None):
+ self.isocc = isocc
+ self.name = name
+
+ def __eq__(self, other):
+ if not ICountry.isImplementedBy(other):
+ return False
+ return other.isocc == self.isocc
+
+ def __str__(self):
+ if self.name is None:
+ return ''
+ else:
+ return self.name
+
+ def __hash__(self):
+ return hash(self.isocc)
+
+ def __repr__(self):
+ return '<Country %s>' % self.isocc
+
+class Area(object):
+
+ __allow_access_to_unprotected_subobjects__ = 1
+ __implements__ = (IArea, )
+
+ name = None
+ countries = []
+
+ def __init__(self, name):
+ self.name = name
+ self.countries = []
+
+ def __cmp__(self, other):
+ if not IArea.isImplementedBy(other):
+ return -1
+ return cmp(self.name, other.name)
+
+ def __str__(self):
+ return self.name
+
+ def addCountry(self, country):
+ if ICountry.isImplementedBy(country):
+ self.countries.append(country)
+ else:
+ raise TypeError, 'Parameter country is not implementing ICountry.'
+
+ def delCountry(self, country):
+ self.countries.remove(country)
+
+ def __hash__(self):
+ return hash(self.name)
+
+ def __repr__(self):
+ return '<Area %s>' % self.name
+
+
+class CountryUtility(SimpleItem):
+ """Utility providing countrywidget support functionality"""
+ security = ClassSecurityInfo()
+
+ zope.interface.implements(ICountryUtility)
+
+ _country_list = []
+ _area_list = []
+
+ def __init__(self):
+ self.manage_countries_reset()
+
+ security.declareProtected(access_contents_information,
'getCountryIsoDict')
+ def getCountryIsoDict(self):
+ cdict = {}
+ for country in self.listCountries():
+ cdict[country.isocc] = country.name
+ for area in self._area_list:
+ for country in area.countries:
+ cdict[country.isocc] = country.name
+ return cdict
+
+ security.declareProtected(access_contents_information,
'getCountryIsoList')
+ def getCountryIsoList(self):
+ clist = self.getCountryIsoDict().items()
+ clist.sort(lambda a,b: cmp(a[1], b[1]))
+ return tuple(clist)
+
+ security.declareProtected(access_contents_information,
+ 'getCountryByIsoCode')
+ def getCountryByIsoCode(self,cc):
+ cdict = self.getCountryIsoDict()
+ name = cdict.get(cc, cc)
+ return Country(cc, name)
+
+ security.declareProtected(access_contents_information, 'listCountries')
+ def listCountries(self):
+ """return sequence of unasigned countries"""
+ return tuple(self._country_list)
+
+ security.declareProtected(access_contents_information, 'listAreas')
+ def listAreas(self, filter=None, omit=None):
+ """list available areas"""
+ assert filter is None or isinstance(filter, (tuple, list))
+ assert omit is None or isinstance(omit, (tuple, list))
+
+ if filter is None and omit is None:
+ areas = self._area_list
+ else:
+ areas = []
+ for area in self._area_list:
+ a = Area(area.name)
+ add = area.countries
+ if filter is not None:
+ add = [ c for c in add if c.isocc in filter ]
+ if omit is not None:
+ add = [ c for c in add if c.isocc not in omit ]
+
+ for country in add:
+ a.addCountry(country)
+ if a.countries:
+ areas.append(a)
+ return tuple(areas)
+
+ security.declareProtected(access_contents_information, 'getArea')
+ def getArea(self, countrycode):
+ """returns area name of country code"""
+ for area in self.listAreas():
+ if countrycode in [c.isocc for c in area.countries]:
+ return area.name
+ return None
+
+
+#######
+# management methods
+
+ security.declareProtected(manage_properties, 'manage_countries_reset')
+ def manage_countries_reset(self):
+ """reset country/area lists"""
+ self._country_list = []
+ self._area_list = []
+
+ for cc, name in COUNTRIES.items():
+ c = Country(cc, name)
+ self._country_list.append(c)
+ self._sort_country_list()
+
+ security.declareProtected(manage_properties,
'manage_countries_addCountry')
+ def manage_countries_addCountry(self, cc, name):
+ """Add a new (custom) country.
+
+ cc ... str, two digit ISO country code
+ name ... str, name of country
+ """
+ # method is only used by Installer of products using ATCountryWidget
+ c = Country(cc, name)
+ self._country_list.append(c)
+
+ security.declareProtected(manage_properties, 'manage_countries_addArea')
+ def manage_countries_addArea(self, area_name):
+ """add a new area"""
+ a = Area(area_name)
+ self._area_list.append(a)
+ self._p_changed = 1
+
+ security.declareProtected(manage_properties,
+ 'manage_counties_addCountryToArea')
+ def manage_countries_addCountryToArea(self, area, ccs):
+ """add country to area"""
+ clist = self._country_list
+ alist = self._area_list
+ a_id = alist.index(Area(area))
+ a = alist[a_id]
+ for cc in ccs:
+ c_id = clist.index(Country(cc))
+ c = clist[c_id]
+ del(clist[c_id])
+ a.addCountry(c)
+ self._p_changed = 1
+
+ security.declareProtected(manage_properties,
'manage_countries_moveUpArea')
+ def manage_countries_moveUpArea(self, area):
+ """move area up"""
+ self._move_area(area, -1)
+
+ security.declareProtected(manage_properties,
+ 'manage_countries_moveDownArea')
+ def manage_countries_moveDownArea(self, area):
+ """move area up"""
+ self._move_area(area, 1)
+
+ security.declareProtected(manage_properties,
'manage_countries_deleteArea')
+ def manage_countries_deleteArea(self, area):
+ "remove area"
+ alist = self._area_list
+ a_id = alist.index(Area(area))
+ a = alist[a_id]
+ del(alist[a_id])
+ for c in a.countries:
+ self._country_list.append(c)
+ self._sort_country_list()
+ self._p_changed = 1
+
+ security.declareProtected(manage_properties,
+ 'manage_countries_moveUpCountry')
+ def manage_countries_moveUpCountry(self, area, country):
+ "move country up"
+ self._move_country(area, country, -1)
+
+ security.declareProtected(manage_properties,
+ 'manage_countries_moveDownCountry')
+ def manage_countries_moveDownCountry(self, area, country):
+ "move country down"
+ self._move_country(area, country, 1)
+
+ security.declareProtected(manage_properties,
+ 'manage_countries_deleteCountryFromArea')
+ def manage_countries_deleteCountryFromArea(self, area, country):
+ "remove country from area"
+ self._remove_country(area, country)
+ self._sort_country_list()
+
+ security.declareProtected(manage_properties, 'manage_countries_sortArea')
+ def manage_countries_sortArea(self, area):
+ """sort area's countries by name"""
+ alist = self._area_list
+ a_id = alist.index(Area(area))
+ a = alist[a_id]
+ a.countries.sort(lambda a, b: cmp(a.name, b.name))
+
+ security.declareProtected(manage_properties,
'manage_generate_po_template')
+ def manage_generate_po_template(self):
+ """generate .po tempalte"""
+ areas = self.listAreas()
+ ret = []
+ ret.append('# areas')
+ for area in areas:
+ ret.append('msgid "'+area.name.strip()+'"')
+ ret.append('msgstr "'+area.name.strip()+'"')
+ ret.append('')
+
+ ret.append('# countries')
+ for area in areas:
+ for country in area.countries:
+ ret.append('msgid "'+country.name.strip()+'"')
+ ret.append('msgstr "'+country.name.strip()+'"')
+ ret.append('')
+
+ return '\n'.join(ret)
+
+ #########
+ # private
+
+ security.declarePrivate('_sort_country_list')
+ def _sort_country_list(self):
+ self._country_list.sort(lambda x,y: cmp(x.name, y.name))
+ self._p_changed = 1
+
+ security.declarePrivate('_move_area')
+ def _move_area(self, area, direction):
+ alist = self._area_list
+ a_id = alist.index(Area(area))
+ a = alist[a_id]
+ del(alist[a_id])
+ alist.insert(a_id + direction, a)
+ self._p_changed = 1
+
+ security.declarePrivate('_move_country')
+ def _move_country(self, area, isocc, direction):
+ alist = self._area_list
+ a_id = alist.index(Area(area))
+ a = alist[a_id]
+ countries = a.countries
+ c_id = countries.index(Country(isocc))
+ c = countries[c_id]
+ del(countries[c_id])
+ countries.insert(c_id + direction, c)
+ self._p_changed = 1
+
+ security.declarePrivate('_remove_country')
+ def _remove_country(self, area, isocc):
+ alist = self._area_list
+ a_id = alist.index(Area(area))
+ a = alist[a_id]
+ countries = a.countries
+ c_id = countries.index(Country(isocc))
+ c = countries[c_id]
+ del(countries[c_id])
+ self._country_list.append(c)
+ self._p_changed = 1
+
+
+InitializeClass(CountryUtility)
+
+def manage_addCountryUtils(dispatcher):
+ "add CountryUtils"
+ util = CountryUtility()
+ dispatcher._setOb(util.id, util)
+
Added: gocept.countrywidget/trunk/src/gocept/countrywidget/interfaces.py
==============================================================================
--- (empty file)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/interfaces.py Tue Dec
4 11:00:13 2007
(at)(at) -0,0 +1,63 (at)(at)
+# Copyright (c) 2004 gocept. All rights reserved.
+# See also LICENSE.txt
+# $Id$
+
+from Interface import Interface, Attribute
+
+class ICountry(Interface):
+ """represens a country"""
+
+ isocc = Attribute("The offical two-digit ISO country code")
+ name = Attribute("The country's name, or None if unknown")
+
+
+class IArea(Interface):
+ """a collection of countries, semantically grouped"""
+
+ name = Attribute("Area's name, like 'Middle east'")
+ countries = Attribute("Sequence of ICountry instances")
+
+
+
+class ICountryUtils(Interface):
+ """A tool prodiving helper methods for ATCountryWidget"""
+
+ def getCountryIsoDict():
+ """returns a iso-code to name mapping
+
+ returns dict-like object
+ """
+
+ def getCountryByIsoCode(cc):
+ """returns a country name by the ISO-code
+
+ cc: str
+ returns ICountry instance
+
+ NOTE: if there is no name for the given county code a country with
+ isocc == name is returned
+ """
+
+ def getCountryIsoList():
+ """returns a sequence of tuples (country name, country code)
+
+ NOTE: the returned sequence is sorted alphabetically by country name
+
+ returns sequence
+ """
+
+ def listAreas(filter=None, omit=None):
+ """get list of areas known to the system
+
+ filter: sequence of str or None
+ if filter is not None a list of isoccs is expected. The areas
+ country lists will only contain countries listed.
+ omit: sequence of str or None
+ if omit is not None a list of isoccs is expected. The areas
+ country list will only contain countries which are *not* listed.
+
+
+ If either filter or omit is given, only non empay areas are returned.
+
+ returns sequence of IArea instances
+ """
|
SVN: r5461 - in gocept.countrywidget/trunk/src/gocept/countrywidget: . Extensions old old/Extensions old/tests old/www tests www
Daniel Havlik <dh(at)gocept.com> |
2007-12-04 11:02:04 |
[ FULL ]
|
Author: nilo
Date: Tue Dec 4 11:02:02 2007
New Revision: 5461
Log:
moved old code to own directory
Added:
gocept.countrywidget/trunk/src/gocept/countrywidget/old/
gocept.countrywidget/trunk/src/gocept/countrywidget/old/Extensions/
- copied from r5455,
gocept.countrywidget/trunk/src/gocept/countrywidget/Extensions/
gocept.countrywidget/trunk/src/gocept/countrywidget/old/Widget.py
- copied unchanged from r5455,
gocept.countrywidget/trunk/src/gocept/countrywidget/Widget.py
gocept.countrywidget/trunk/src/gocept/countrywidget/old/tests/
- copied from r5455,
gocept.countrywidget/trunk/src/gocept/countrywidget/tests/
gocept.countrywidget/trunk/src/gocept/countrywidget/old/utils.py
- copied unchanged from r5455,
gocept.countrywidget/trunk/src/gocept/countrywidget/utils.py
gocept.countrywidget/trunk/src/gocept/countrywidget/old/validators.py
- copied unchanged from r5455,
gocept.countrywidget/trunk/src/gocept/countrywidget/validators.py
gocept.countrywidget/trunk/src/gocept/countrywidget/old/www/
- copied from r5455,
gocept.countrywidget/trunk/src/gocept/countrywidget/www/
Removed:
gocept.countrywidget/trunk/src/gocept/countrywidget/Extensions/
gocept.countrywidget/trunk/src/gocept/countrywidget/Widget.py
gocept.countrywidget/trunk/src/gocept/countrywidget/tests/
gocept.countrywidget/trunk/src/gocept/countrywidget/utils.py
gocept.countrywidget/trunk/src/gocept/countrywidget/validators.py
gocept.countrywidget/trunk/src/gocept/countrywidget/www/
|
SVN: r5462 - gocept.countrywidget/trunk/src/gocept/countrywidget
Daniel Havlik <dh(at)gocept.com> |
2007-12-04 11:02:40 |
[ FULL ]
|
Author: nilo
Date: Tue Dec 4 11:02:37 2007
New Revision: 5462
Log:
dumping version, removed refresh.txt
Removed:
gocept.countrywidget/trunk/src/gocept/countrywidget/refresh.txt
Modified:
gocept.countrywidget/trunk/src/gocept/countrywidget/version.txt
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/version.txt
==============================================================================
--- gocept.countrywidget/trunk/src/gocept/countrywidget/version.txt (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/version.txt Tue Dec 4
11:02:37 2007
(at)(at) -1 +1 (at)(at)
-0.2.4
+0.3-rc
|
SVN: r5463 - in gocept.countrywidget/trunk/src/gocept/countrywidget: . profiles/default
Daniel Havlik <dh(at)gocept.com> |
2007-12-05 14:37:25 |
[ FULL ]
|
Author: nilo
Date: Wed Dec 5 14:37:22 2007
New Revision: 5463
Log:
zwischenstand
Added:
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/default/toolset.xml
Modified:
gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py
gocept.countrywidget/trunk/src/gocept/countrywidget/configure.zcml
gocept.countrywidget/trunk/src/gocept/countrywidget/countryutility.py
gocept.countrywidget/trunk/src/gocept/countrywidget/interfaces.py
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py
==============================================================================
--- gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/__init__.py Wed Dec 5
14:37:22 2007
(at)(at) -1,30 +1,2 (at)(at)
-# Copyright (c) 2004 gocept. All rights reserved.
-# See also LICENSE.txt
-# $Id$
-
-# Zope, Plone
-from Products.Archetypes.public import process_types, listTypes
-from Products.CMFCore import utils as cmfcutils
-from Products.CMFCore.DirectoryView import registerDirectory
-from Products.validation import validation
-
-# siblings
-from config import access_contents_information
-from validators import CountryValidator
-
def initialize(context):
- #tool
- import CountryTool
- tool = cmfcutils.ToolInit('Country Tool',
tools=(CountryTool.CountryUtils,),
- product_name='Country_Tool', icon='www/tool.gif')
- tool.initialize(context)
-
- #validator
- validation.register(CountryValidator('isValidISOCountry'))
-
- context.registerClass(
- CountryTool.CountryUtils,
- constructors=(CountryTool.manage_addCountryUtils,),
- icon='www/tool.gif')
-
-
+ pass
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/configure.zcml
==============================================================================
---
gocept.countrywidget/trunk/src/gocept/countrywidget/configure.zcml (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/configure.zcml Wed Dec
5 14:37:22 2007
(at)(at) -2,8 +2,6 (at)(at)
xmlns="http://namespaces.zope.org/zope"
i18n_domain="gocept.countrywidget">
- <include package=".browser" />
-
<include file="skins.zcml" />
<include file="profiles.zcml" />
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/countryutility.py
==============================================================================
---
gocept.countrywidget/trunk/src/gocept/countrywidget/countryutility.py (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/countryutility.py Wed
Dec 5 14:37:22 2007
(at)(at) -3,22 +3,19 (at)(at)
# $Id$
# Zope imports
-from AccessControl import ClassSecurityInfo
-from OFS.SimpleItem import SimpleItem
-from Globals import InitializeClass
-
-# Zope Products imports
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-from Products.CMFCore.utils import UniqueObject
+
+import zope.interface
+import AccessControl
+import Products.OFS.SimpleItem
# Siblings
-from Interfaces import ICountry, IArea, ICountryUtils
-from config import access_contents_information, manage_properties, COUNTRIES
+import gocept.countrywidget.interfaces
+import gocept.countrywidget.config
class Country(object):
__allow_access_to_unprotected_subobjects__ = 1
- __implements__ = (ICountry, )
+ zope.interface.implements(gocept.countrywidget.interfaces.ICountry)
isocc = None
name = None
(at)(at) -47,7 +44,7 (at)(at)
class Area(object):
__allow_access_to_unprotected_subobjects__ = 1
- __implements__ = (IArea, )
+ zope.interface.implements(gocept.countrywidget.interfaces.IArea)
name = None
countries = []
(at)(at) -82,7 +79,7 (at)(at)
class CountryUtility(SimpleItem):
"""Utility providing countrywidget support functionality"""
- security = ClassSecurityInfo()
+ security = AccessControl.ClassSecurityInfo()
zope.interface.implements(ICountryUtility)
(at)(at) -162,7 +159,7 (at)(at)
self._country_list = []
self._area_list = []
- for cc, name in COUNTRIES.items():
+ for cc, name in gocept.countrywidget.COUNTRIES.items():
c = Country(cc, name)
self._country_list.append(c)
self._sort_country_list()
(at)(at) -312,7 +309,6 (at)(at)
self._p_changed = 1
-InitializeClass(CountryUtility)
def manage_addCountryUtils(dispatcher):
"add CountryUtils"
Modified: gocept.countrywidget/trunk/src/gocept/countrywidget/interfaces.py
==============================================================================
---
gocept.countrywidget/trunk/src/gocept/countrywidget/interfaces.py (original)
+++ gocept.countrywidget/trunk/src/gocept/countrywidget/interfaces.py Wed Dec
5 14:37:22 2007
(at)(at) -1,25 +1,25 (at)(at)
# Copyright (c) 2004 gocept. All rights reserved.
# See also LICENSE.txt
-# $Id$
+# $Id: zope.interface.Interfaces.py 5455 2007-12-04 07:35:30Z nilo $
-from Interface import Interface, Attribute
+import zope.interface
-class ICountry(Interface):
+class ICountry(zope.interface.Interface):
"""represens a country"""
- isocc = Attribute("The offical two-digit ISO country code")
- name = Attribute("The country's name, or None if unknown")
+ isocc = zope.interface.Attribute("The offical two-digit ISO country code")
+ name = zope.interface.Attribute("The country's name, or None if unknown")
-class IArea(Interface):
+class IArea(zope.interface.Interface):
"""a collection of countries, semantically grouped"""
- name = Attribute("Area's name, like 'Middle east'")
- countries = Attribute("Sequence of ICountry instances")
+ name = zope.interface.Attribute("Area's name, like 'Middle east'")
+ countries = zope.interface.Attribute("Sequence of ICountry instances")
-class ICountryUtils(Interface):
+class ICountryUtility(zope.interface.Interface):
"""A tool prodiving helper methods for ATCountryWidget"""
def getCountryIsoDict():
Added:
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/default/toolset.xml
==============================================================================
--- (empty file)
+++
gocept.countrywidget/trunk/src/gocept/countrywidget/profiles/default/toolset.xml Wed
Dec 5 14:37:22 2007
(at)(at) -0,0 +1,5 (at)(at)
+<?xml version="1.0"?>
+<tool-setup>
+ <required tool_id="countryutility"
+ class="gocept.countrywidget.countryutility"/>
+</tool-setup>
|
SVN: r5464 - ATCountryWidget/trunk/Extensions
Daniel Havlik <dh(at)gocept.com> |
2007-12-05 14:43:47 |
[ FULL ]
|
Author: nilo
Date: Wed Dec 5 14:43:45 2007
New Revision: 5464
Log:
replaced YU with RS in installer
Modified:
ATCountryWidget/trunk/Extensions/Install.py
Modified: ATCountryWidget/trunk/Extensions/Install.py
==============================================================================
--- ATCountryWidget/trunk/Extensions/Install.py (original)
+++ ATCountryWidget/trunk/Extensions/Install.py Wed Dec 5 14:43:45 2007
(at)(at) -37,7 +37,7 (at)(at)
countrytool.manage_countries_sortArea('Europe (Western)')
countrytool.manage_countries_addArea('Europe (Central)')
- countrytool.manage_countries_addCountryToArea('Europe (Central)',
['CZ','HU','PL','RO','SK','HR','AL','BG','BA','GR','SI','YU','MK'])
+ countrytool.manage_countries_addCountryToArea('Europe (Central)',
['CZ','HU','PL','RO','SK','HR','AL','BG','BA','GR','SI','RS','MK'])
countrytool.manage_countries_sortArea('Europe (Central)')
countrytool.manage_countries_addArea('Europe (Eastern)')
|
SVN: r5467 - in gocept.mochikit/trunk: . src/gocept/mochikit
Christian Zagrodnick <cz(at)gocept.com> |
2007-12-07 16:45:07 |
[ FULL ]
|
Author: zagy
Date: Fri Dec 7 16:45:04 2007
New Revision: 5467
Log:
* Created a viewlet manager to allow easy dynamic javascript injection
Added:
gocept.mochikit/trunk/src/gocept/mochikit/ftesting.zcml
gocept.mochikit/trunk/src/gocept/mochikit/interfaces.py (contents, props
changed)
gocept.mochikit/trunk/src/gocept/mochikit/tests.py (contents, props
changed)
gocept.mochikit/trunk/src/gocept/mochikit/viewletmanager.txt (contents,
props changed)
Modified:
gocept.mochikit/trunk/README.txt
gocept.mochikit/trunk/setup.py
gocept.mochikit/trunk/src/gocept/mochikit/configure.zcml
Modified: gocept.mochikit/trunk/README.txt
==============================================================================
--- gocept.mochikit/trunk/README.txt (original)
+++ gocept.mochikit/trunk/README.txt Fri Dec 7 16:45:04 2007
(at)(at) -44,9 +44,11 (at)(at)
Changes
=======
-1.4 (unreleased)
+1.3.1 (2007-12-07)
++++++++++++++++
+* Created a viewlet manager to allow easy dynamic javascript injection
+
1.3 (2007-11-26)
++++++++++++++++
Modified: gocept.mochikit/trunk/setup.py
==============================================================================
--- gocept.mochikit/trunk/setup.py (original)
+++ gocept.mochikit/trunk/setup.py Fri Dec 7 16:45:04 2007
(at)(at) -27,6 +27,7 (at)(at)
namespace_packages = ['gocept'],
install_requires = [
'setuptools',
+ 'zope.viewlet',
'zc.resourcelibrary',
],
extras_require = {
Modified: gocept.mochikit/trunk/src/gocept/mochikit/configure.zcml
==============================================================================
--- gocept.mochikit/trunk/src/gocept/mochikit/configure.zcml (original)
+++ gocept.mochikit/trunk/src/gocept/mochikit/configure.zcml Fri Dec 7
16:45:04 2007
(at)(at) -7,6 +7,12 (at)(at)
</resourceLibrary>
<include file="libraries.zcml" />
+
+ <browser:viewletManager
+ name="gocept.mochikit.javascript"
+ provides=".interfaces.IJavascriptViewletManager"
+ permission="zope.View"
+ />
</configure>
Added: gocept.mochikit/trunk/src/gocept/mochikit/ftesting.zcml
==============================================================================
--- (empty file)
+++ gocept.mochikit/trunk/src/gocept/mochikit/ftesting.zcml Fri Dec 7 16:45:04
2007
(at)(at) -0,0 +1,17 (at)(at)
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser">
+
+ <include package="zope.app.zcmlfiles" />
+ <include package="zope.formlib" />
+ <include package="zope.app.form.browser" />
+ <include package="zope.contentprovider" />
+ <include package="zope.viewlet" file="meta.zcml" />
+ <include package="zope.viewlet" />
+
+ <include package="zc.resourcelibrary" file="meta.zcml" />
+ <include package="zc.resourcelibrary" />
+
+ <include package="gocept.mochikit" />
+
+</configure>
Added: gocept.mochikit/trunk/src/gocept/mochikit/interfaces.py
==============================================================================
--- (empty file)
+++ gocept.mochikit/trunk/src/gocept/mochikit/interfaces.py Fri Dec 7 16:45:04
2007
(at)(at) -0,0 +1,9 (at)(at)
+# Copyright (c) 2007 gocept gmbh & co. kg
+# See also LICENSE.txt
+# $Id$
+
+import zope.viewlet.interfaces
+
+
+class IJavascriptViewletManager(zope.viewlet.interfaces.IViewletManager):
+ """Viewletmanager for javascripts."""
Added: gocept.mochikit/trunk/src/gocept/mochikit/tests.py
==============================================================================
--- (empty file)
+++ gocept.mochikit/trunk/src/gocept/mochikit/tests.py Fri Dec 7 16:45:04 2007
(at)(at) -0,0 +1,36 (at)(at)
+# Copyright (c) 2007 gocept gmbh & co. kg
+# See also LICENSE.txt
+# $Id$
+
+import os
+import unittest
+
+from zope.testing import doctest
+
+import zope.app.testing.functional
+
+
+Layer = zope.app.testing.functional.ZCMLLayer(
+ os.path.join(os.path.dirname(__file__), 'ftesting.zcml'),
+ __name__, 'gocept.mochikit', allow_teardown=True)
+
+
+def FunctionalDocFileSuite(*paths, **kw):
+ try:
+ layer = kw['layer']
+ except KeyError:
+ layer = Layer
+ else:
+ del kw['layer']
+ kw['package'] = doctest._normalize_module(kw.get('package'))
+ test = zope.app.testing.functional.FunctionalDocFileSuite(
+ *paths, **kw)
+ test.layer = layer
+ return test
+
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(FunctionalDocFileSuite(
+ 'viewletmanager.txt'))
+ return suite
Added: gocept.mochikit/trunk/src/gocept/mochikit/viewletmanager.txt
==============================================================================
--- (empty file)
+++ gocept.mochikit/trunk/src/gocept/mochikit/viewletmanager.txt Fri Dec 7
16:45:04 2007
(at)(at) -0,0 +1,33 (at)(at)
+===============
+Viewlet manager
+===============
+
+gocept.mochikit defines a viewlet manager where javascripts can be injected.
+
+
+Use a silly object as content:
+
+>>> content = object()
+
+Create a test request:
+>>> import zope.publisher.browser
+>>> request = zope.publisher.browser.TestRequest()
+
+
+Create a view class and instanciate:
+
+>>> import zope.publisher.browser
+>>> class View(zope.publisher.browser.BrowserView):
+... pass
+>>> view = View(content, request)
+
+
+Get the provider:
+
+>>> provider = zope.component.getMultiAdapter(
+... (content, request, view),
+... zope.contentprovider.interfaces.IContentProvider,
+... name='gocept.mochikit.javascript')
+>>> provider
+<zope.viewlet.manager.<ViewletManager providing
IJavascriptViewletManager>
+ object at 0x...>
|
|