Skip to content
This repository has been archived by the owner on Dec 18, 2020. It is now read-only.

Commit

Permalink
Ported to Python 3.3. Also removed browser code, since it was ancient…
Browse files Browse the repository at this point in the history
… and

not working anymore.
  • Loading branch information
strichter committed Mar 4, 2013
1 parent f288833 commit 499196b
Show file tree
Hide file tree
Showing 27 changed files with 162 additions and 488 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,4 +9,5 @@ src/*.egg-info
bin
build
develop-eggs
dist
parts
15 changes: 12 additions & 3 deletions CHANGES.txt
Expand Up @@ -2,10 +2,19 @@
CHANGES
=======

1.0.1 (unreleased)
------------------
2.0.0a1 (unreleased)
--------------------

- Added support for Python 3.3.

- Dropped browser support completely, since it relied on really old o-wrap
techniques. Also, it contained Lovely-specif project language from about 7
years ago. ;-)

- Replaced deprecated ``zope.interface.implements`` usage with equivalent
``zope.interface.implementer`` decorator.

- Nothing changed yet.
- Dropped support for Python 2.4 and 2.5.


1.0.0 (2013-02-26)
Expand Down
Binary file added ZODB-4.0.0dev.tar.gz
Binary file not shown.
36 changes: 34 additions & 2 deletions buildout.cfg
@@ -1,6 +1,14 @@
[buildout]
develop = .
parts = test coverage checker
find-links =
${buildout:directory}/ZODB-4.0.0dev.tar.gz
parts = py test coverage checker
versions = versions

[py]
recipe = zc.recipe.egg
eggs = z3c.sampledata [test]
interpreter = py

[test]
recipe = zc.recipe.testrunner
Expand All @@ -13,4 +21,28 @@ eggs = createzopecoverage

[checker]
recipe = lovely.recipe:importchecker
path = src/z3c/sampledata
path = src/z3c/sampledata

[versions]
ZODB = 4.0.0dev
zope.app.appsetup = 4.0.0a1
zope.app.publication = 4.0.0a1.dev
zope.app.wsgi = 4.0.0a3
zope.browserpage = 4.1.0a1
zope.container = 4.0.0a2
zope.contentprovider = 4.0.0a1
zope.i18n = 4.0.0a4
zope.index = 4.0.0
zope.intid = 4.0.0a1
zope.keyreference = 4.0.0a1
zope.paste = 1.0.0a1
zope.pluggableauth = 2.0.0a1
zope.principalregistry = 4.0.0a2
zope.publisher = 4.0.0a3
zope.security = 4.0.0a3
zope.securitypolicy = 4.0.0a1
zope.session = 4.0.0a1
zope.site = 4.0.0a1
zope.tal = 4.0.0a1
zope.traversing = 4.0.0a2
zope.viewlet = 4.0.0a1
17 changes: 5 additions & 12 deletions setup.py
Expand Up @@ -12,8 +12,6 @@
#
##############################################################################
"""Setup
$Id:$
"""
import os
from setuptools import setup, find_packages
Expand All @@ -23,7 +21,7 @@ def read(*rnames):

setup (
name='z3c.sampledata',
version='1.0.1.dev0',
version='2.0.0a1.dev0',
author = "Stephan Richter and the Zope Community",
author_email = "zope-dev@zope.org",
description = "Sampledata Generator",
Expand Down Expand Up @@ -61,18 +59,11 @@ def read(*rnames):
package_dir = {'':'src'},
namespace_packages = ['z3c'],
extras_require = dict(
browser = [
'zope.browserpage',
'zope.traversing',
],
testing = [
'ZODB3',
'ZODB',
],
test = [
'zope.app.testing',
'zope.app.zcmlfiles',
'zope.untrustedpython',
'zope.viewlet',
'zope.testing',
],
),
install_requires = [
Expand All @@ -87,5 +78,7 @@ def read(*rnames):
'zope.schema',
'zope.site',
],
tests_require=['zope.testing'],
test_suite='z3c.sampledata.tests.test_suite',
zip_safe = False,
)
22 changes: 11 additions & 11 deletions src/z3c/sampledata/README.txt
Expand Up @@ -35,28 +35,28 @@ A generator generates sample data.
>>> from zope import component
>>> from z3c.sampledata.interfaces import ISampleDataPlugin

>>> class GeneratePrincipals(object):
... interface.implements(ISampleDataPlugin)
>>> @interface.implementer(ISampleDataPlugin)
... class GeneratePrincipals(object):
... dependencies = []
... schema = None
... def generate(self, context, param={}, dataSource=None, seed=None):
... print self.__class__.__name__
... print(self.__class__.__name__)
... if dataSource is not None:
... for data in dataSource:
... print '- %s'%data['login']
... print('- %s'%data['login'])
>>> principalPlugin = GeneratePrincipals()

For our tests we provide another generator :

>>> class GenerateSite(object):
... interface.implements(ISampleDataPlugin)
>>> @interface.implementer(ISampleDataPlugin)
... class GenerateSite(object):
... dependencies = []
... schema = None
... def generate(self, context, param={}, dataSource=None, seed=None):
... if 'sitename' in param:
... print 'This is site %r'%param['sitename']
... print('This is site %r'%param['sitename'])
... else:
... print self.__class__.__name__
... print(self.__class__.__name__)
... return 'I am from the site'
>>> sitePlugin = GenerateSite()

Expand Down Expand Up @@ -103,7 +103,7 @@ manager.

A manager provides it's generators.

>>> manager.generators.keys()
>>> list(manager.generators.keys())
['z3c.sampledata.principals']

We can tell the manager to generate all samples.
Expand Down Expand Up @@ -165,8 +165,8 @@ Cycles in the generator definition

A test for a complex dependency.

>>> class Generator(object):
... interface.implements(ISampleDataPlugin)
>>> @interface.implementer(ISampleDataPlugin)
... class Generator(object):
... name = 'generator'
... dependencies = []
... schema = None
Expand Down
3 changes: 1 addition & 2 deletions src/z3c/sampledata/__init__.py
Expand Up @@ -14,8 +14,7 @@
"""
"""
import zope.i18nmessageid

_ = zope.i18nmessageid.MessageFactory('sampledata')

from manager import Manager
from z3c.sampledata.manager import Manager

31 changes: 31 additions & 0 deletions src/z3c/sampledata/_compat.py
@@ -0,0 +1,31 @@
##############################################################################
#
# Copyright (c) 2005 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Compatibility between Python versions
"""
import base64
import sys

PY3 = sys.version_info[0] >= 3

if PY3:

unicode = str
basestring = str

def toUnicode(obj):
return obj.decode() if isinstance(obj, bytes) else str(obj)

else:

unicode = toUnicode = unicode
basestring = basestring
35 changes: 0 additions & 35 deletions src/z3c/sampledata/browser/README.txt

This file was deleted.

Empty file.
22 changes: 0 additions & 22 deletions src/z3c/sampledata/browser/configure.zcml

This file was deleted.

39 changes: 0 additions & 39 deletions src/z3c/sampledata/browser/generate.pt

This file was deleted.

24 changes: 0 additions & 24 deletions src/z3c/sampledata/browser/managers.pt

This file was deleted.

34 changes: 0 additions & 34 deletions src/z3c/sampledata/browser/testmanager.zcml

This file was deleted.

0 comments on commit 499196b

Please sign in to comment.