Skip to content
Browse files

initial commit

  • Loading branch information...
0 parents commit f4e4cebe8adb132ff2211112e2a67c29d8ccd906 @zupo zupo committed Dec 18, 2012
9 .gitignore
@@ -0,0 +1,9 @@
+.installed.cfg
+.mr.developer.cfg
+bin
+develop-eggs
+docs/html
+include
+lib
+parts
+var
13 .travis.yml
@@ -0,0 +1,13 @@
+language: python
+python:
+ - {{{ python.version }}}
+
+install:
+ - make python=$( which python ) .installed.cfg
+
+script:
+ - make tests
+
+notifications:
+ irc:
+ - "{{{ author.irc }}}"
2 MANIFEST.in
@@ -0,0 +1,2 @@
+graft src/niteoweb
+include *.cfg *.rst *.in
30 README.rst
@@ -0,0 +1,30 @@
+====================
+niteoweb.ipn
+====================
+
+A Plone add-on that ...
+
+* `Source code @ GitHub <https://github.com/niteoweb/niteoweb.ipn>`_
+* `Releases @ PyPI <http://pypi.python.org/pypi/niteoweb.ipn>`_
+* `Documentation @ ReadTheDocs <http://ipnipn.readthedocs.org>`_
+* `Continuous Integration @ Travis-CI <http://travis-ci.org/niteoweb/niteoweb.ipn>`_
+
+How it works
+============
+
+...
+
+
+Installation
+============
+
+To install `niteoweb.ipn` you simply add ``niteoweb.ipn``
+to the list of eggs in your buildout, run buildout and restart Plone.
+Then, install `niteoweb.ipn` using the Add-ons control panel.
+
+
+Configuration
+=============
+
+...
+
263 bootstrap.py
@@ -0,0 +1,263 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+"""
+
+import os, shutil, sys, tempfile, urllib, urllib2, subprocess
+from optparse import OptionParser
+
+if sys.platform == 'win32':
+ def quote(c):
+ if ' ' in c:
+ return '"%s"' % c # work around spawn lamosity on windows
+ else:
+ return c
+else:
+ quote = str
+
+# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments.
+stdout, stderr = subprocess.Popen(
+ [sys.executable, '-Sc',
+ 'try:\n'
+ ' import ConfigParser\n'
+ 'except ImportError:\n'
+ ' print 1\n'
+ 'else:\n'
+ ' print 0\n'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+has_broken_dash_S = bool(int(stdout.strip()))
+
+# In order to be more robust in the face of system Pythons, we want to
+# run without site-packages loaded. This is somewhat tricky, in
+# particular because Python 2.6's distutils imports site, so starting
+# with the -S flag is not sufficient. However, we'll start with that:
+if not has_broken_dash_S and 'site' in sys.modules:
+ # We will restart with python -S.
+ args = sys.argv[:]
+ args[0:0] = [sys.executable, '-S']
+ args = map(quote, args)
+ os.execv(sys.executable, args)
+# Now we are running with -S. We'll get the clean sys.path, import site
+# because distutils will do it later, and then reset the path and clean
+# out any namespace packages from site-packages that might have been
+# loaded by .pth files.
+clean_path = sys.path[:]
+import site # imported because of its side effects
+sys.path[:] = clean_path
+for k, v in sys.modules.items():
+ if k in ('setuptools', 'pkg_resources') or (
+ hasattr(v, '__path__') and
+ len(v.__path__) == 1 and
+ not os.path.exists(os.path.join(v.__path__[0], '__init__.py'))):
+ # This is a namespace package. Remove it.
+ sys.modules.pop(k)
+
+is_jython = sys.platform.startswith('java')
+
+setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py'
+distribute_source = 'http://python-distribute.org/distribute_setup.py'
+
+
+# parsing arguments
+def normalize_to_url(option, opt_str, value, parser):
+ if value:
+ if '://' not in value: # It doesn't smell like a URL.
+ value = 'file://%s' % (
+ urllib.pathname2url(
+ os.path.abspath(os.path.expanduser(value))),)
+ if opt_str == '--download-base' and not value.endswith('/'):
+ # Download base needs a trailing slash to make the world happy.
+ value += '/'
+ else:
+ value = None
+ name = opt_str[2:].replace('-', '_')
+ setattr(parser.values, name, value)
+
+usage = '''\
+[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
+
+Bootstraps a buildout-based project.
+
+Simply run this script in a directory containing a buildout.cfg, using the
+Python that you want bin/buildout to use.
+
+Note that by using --setup-source and --download-base to point to
+local resources, you can keep this script from going over the network.
+'''
+
+parser = OptionParser(usage=usage)
+parser.add_option("-v", "--version", dest="version",
+ help="use a specific zc.buildout version")
+parser.add_option("-d", "--distribute",
+ action="store_true", dest="use_distribute", default=False,
+ help="Use Distribute rather than Setuptools.")
+parser.add_option("--setup-source", action="callback", dest="setup_source",
+ callback=normalize_to_url, nargs=1, type="string",
+ help=("Specify a URL or file location for the setup file. "
+ "If you use Setuptools, this will default to " +
+ setuptools_source + "; if you use Distribute, this "
+ "will default to " + distribute_source + "."))
+parser.add_option("--download-base", action="callback", dest="download_base",
+ callback=normalize_to_url, nargs=1, type="string",
+ help=("Specify a URL or directory for downloading "
+ "zc.buildout and either Setuptools or Distribute. "
+ "Defaults to PyPI."))
+parser.add_option("--eggs",
+ help=("Specify a directory for storing eggs. Defaults to "
+ "a temporary directory that is deleted when the "
+ "bootstrap script completes."))
+parser.add_option("-t", "--accept-buildout-test-releases",
+ dest='accept_buildout_test_releases',
+ action="store_true", default=False,
+ help=("Normally, if you do not specify a --version, the "
+ "bootstrap script and buildout gets the newest "
+ "*final* versions of zc.buildout and its recipes and "
+ "extensions for you. If you use this flag, "
+ "bootstrap and buildout will get the newest releases "
+ "even if they are alphas or betas."))
+parser.add_option("-c", None, action="store", dest="config_file",
+ help=("Specify the path to the buildout configuration "
+ "file to be used."))
+
+options, args = parser.parse_args()
+
+# if -c was provided, we push it back into args for buildout's main function
+if options.config_file is not None:
+ args += ['-c', options.config_file]
+
+if options.eggs:
+ eggs_dir = os.path.abspath(os.path.expanduser(options.eggs))
+else:
+ eggs_dir = tempfile.mkdtemp()
+
+if options.setup_source is None:
+ if options.use_distribute:
+ options.setup_source = distribute_source
+ else:
+ options.setup_source = setuptools_source
+
+if options.accept_buildout_test_releases:
+ args.append('buildout:accept-buildout-test-releases=true')
+args.append('bootstrap')
+
+try:
+ import pkg_resources
+ import setuptools # A flag. Sometimes pkg_resources is installed alone.
+ if not hasattr(pkg_resources, '_distribute'):
+ raise ImportError
+except ImportError:
+ ez_code = urllib2.urlopen(
+ options.setup_source).read().replace('\r\n', '\n')
+ ez = {}
+ exec ez_code in ez
+ setup_args = dict(to_dir=eggs_dir, download_delay=0)
+ if options.download_base:
+ setup_args['download_base'] = options.download_base
+ if options.use_distribute:
+ setup_args['no_fake'] = True
+ ez['use_setuptools'](**setup_args)
+ if 'pkg_resources' in sys.modules:
+ reload(sys.modules['pkg_resources'])
+ import pkg_resources
+ # This does not (always?) update the default working set. We will
+ # do it.
+ for path in sys.path:
+ if path not in pkg_resources.working_set.entries:
+ pkg_resources.working_set.add_entry(path)
+
+cmd = [quote(sys.executable),
+ '-c',
+ quote('from setuptools.command.easy_install import main; main()'),
+ '-mqNxd',
+ quote(eggs_dir)]
+
+if not has_broken_dash_S:
+ cmd.insert(1, '-S')
+
+find_links = options.download_base
+if not find_links:
+ find_links = os.environ.get('bootstrap-testing-find-links')
+if find_links:
+ cmd.extend(['-f', quote(find_links)])
+
+if options.use_distribute:
+ setup_requirement = 'distribute'
+else:
+ setup_requirement = 'setuptools'
+ws = pkg_resources.working_set
+setup_requirement_path = ws.find(
+ pkg_resources.Requirement.parse(setup_requirement)).location
+env = dict(
+ os.environ,
+ PYTHONPATH=setup_requirement_path)
+
+requirement = 'zc.buildout'
+version = options.version
+if version is None and not options.accept_buildout_test_releases:
+ # Figure out the most recent final version of zc.buildout.
+ import setuptools.package_index
+ _final_parts = '*final-', '*final'
+
+ def _final_version(parsed_version):
+ for part in parsed_version:
+ if (part[:1] == '*') and (part not in _final_parts):
+ return False
+ return True
+ index = setuptools.package_index.PackageIndex(
+ search_path=[setup_requirement_path])
+ if find_links:
+ index.add_find_links((find_links,))
+ req = pkg_resources.Requirement.parse(requirement)
+ if index.obtain(req) is not None:
+ best = []
+ bestv = None
+ for dist in index[req.project_name]:
+ distv = dist.parsed_version
+ if _final_version(distv):
+ if bestv is None or distv > bestv:
+ best = [dist]
+ bestv = distv
+ elif distv == bestv:
+ best.append(dist)
+ if best:
+ best.sort()
+ version = best[-1].version
+if version:
+ requirement = '=='.join((requirement, version))
+cmd.append(requirement)
+
+if is_jython:
+ import subprocess
+ exitcode = subprocess.Popen(cmd, env=env).wait()
+else: # Windows prefers this, apparently; otherwise we would prefer subprocess
+ exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env]))
+if exitcode != 0:
+ sys.stdout.flush()
+ sys.stderr.flush()
+ print ("An error occurred when trying to install zc.buildout. "
+ "Look above this message for any errors that "
+ "were output by easy_install.")
+ sys.exit(exitcode)
+
+ws.add_entry(eggs_dir)
+ws.require(requirement)
+import zc.buildout.buildout
+zc.buildout.buildout.main(args)
+if not options.eggs: # clean up temporary egg directory
+ shutil.rmtree(eggs_dir)
+
3 buildout.cfg
@@ -0,0 +1,3 @@
+[buildout]
+extends = buildout.d/development.cfg
+
32 buildout.d/base.cfg
@@ -0,0 +1,32 @@
+[buildout]
+unzip = true
+newest = false
+extends = versions.cfg
+versions = versions
+prefer-final = true
+develop = .
+
+extensions =
+ buildout_versions
+eggs =
+ niteoweb.ipn
+parts =
+ scripts
+
+# network speedup
+socket-timeout = 3
+allow-hosts =
+ *.python.org
+ docutils.sourceforge.net
+ prdownloads.sourceforge.net
+ effbot.org
+
+
+# =============================
+# Generate all scripts for eggs
+# =============================
+[scripts]
+recipe = z3c.recipe.scripts
+dependent-scripts = true
+interpreter = zopepy
+eggs = ${buildout:eggs}
50 buildout.d/development.cfg
@@ -0,0 +1,50 @@
+[buildout]
+extends = base.cfg
+
+parts +=
+ omelette
+ test
+ instance
+
+eggs +=
+ niteoweb.ipn [develop,test]
+
+
+# =========================
+# Develop external packages
+# =========================
+extensions += mr.developer
+sources = sources
+auto-checkout =
+
+[sources]
+plone.api = git https://github.com/plone/plone.api.git
+
+
+# ===============================================
+# Mirrors python namespaces into one handy folder
+# ===============================================
+[omelette]
+recipe = collective.recipe.omelette
+eggs = ${buildout:eggs}
+
+
+# ==========================================
+# Prepare test-runner for running unit tests
+# ==========================================
+[test]
+recipe = zc.recipe.testrunner
+defaults = ['--exit-with-status', '--auto-color', '--auto-progress']
+eggs = ${buildout:eggs}
+
+
+# ==================================
+# Create a development Zope instance
+# ==================================
+[instance]
+recipe = plone.recipe.zope2instance
+user = admin:admin
+debug-mode = off
+verbose-security = on
+environment-vars = zope_i18n_compile_mo_files = true
+eggs = ${buildout:eggs}
11 buildout.d/travis.cfg
@@ -0,0 +1,11 @@
+[buildout]
+extends = development.cfg
+
+# disable extensions to speedup buildout
+extensions -= buildout_versions
+
+# disable some parts to speedup buildout
+parts -=
+ omelette
+ instance
+
9 buildout.d/versions.cfg
@@ -0,0 +1,9 @@
+[buildout]
+extends = http://dist.plone.org/release/4.2.2/versions.cfg
+
+[versions]
+bobtemplates.niteoweb = 0.1.1
+zc.buildout = 1.6.3
+zc.recipe.egg = 1.3.2
+zope.pagetemplate = 3.6.3
+Sphinx = 1.1.3
10 docs/CHANGELOG.rst
@@ -0,0 +1,10 @@
+Changelog
+=========
+
+
+0.1 (unreleased)
+----------------
+
+- Initial release.
+ [zupo]
+
30 docs/LICENSE.rst
@@ -0,0 +1,30 @@
+License (3-clause BSD)
+======================
+
+Copyright (c) 2012, NiteoWeb Ltd.. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of NiteoWeb Ltd.. nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL NITEOWEB LTD. BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
28 docs/api.rst
@@ -0,0 +1,28 @@
+===
+API
+===
+
+
+Miscellaneous
+=============
+
+.. automodule:: niteoweb.ipn
+ :members:
+
+----
+
+.. automodule:: niteoweb.ipn.interfaces
+ :members:
+
+
+Tests
+=====
+
+.. automodule:: niteoweb.ipn.testing
+ :members:
+
+----
+
+.. automodule:: niteoweb.ipn.tests.test_setup
+ :members:
+
184 docs/conf.py
@@ -0,0 +1,184 @@
+# -*- coding: utf-8 -*-
+# niteoweb.plr documentation build configuration file, created by
+# sphinx-quickstart on Mon Feb 8 19:10:04 2010.
+# This file is execfile()d with the current directory set to its
+# containing dir.
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# -- General configuration ----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+from datetime import datetime
+project = u'niteoweb.ipn'
+copyright = u'%s, NiteoWeb Ltd..' % datetime.now().year
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = []
+
+# The reST default role (used for this markup: `text`) to use for all documents
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output --------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'ipndoc'
+
+
+# -- Options for LaTeX output -------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual])
+latex_documents = [
+ ('index',
+ 'ipn.tex',
+ u'niteoweb.ipn Documentation',
+ u'', 'manual'
+ ),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
8 docs/glossary.rst
@@ -0,0 +1,8 @@
+Definitions of basic terms
+==========================
+
+.. glossary::
+
+ First Item
+ Explain first item and add more.
+
23 docs/index.rst
@@ -0,0 +1,23 @@
+.. include:: ../README.rst
+
+
+Developer documentation
+=======================
+
+.. toctree::
+ :maxdepth: 2
+
+ api.rst
+ glossary.rst
+
+
+.. include:: CHANGELOG.rst
+.. include:: LICENSE.rst
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
71 setup.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+"""Installer for the niteoweb.ipn package."""
+
+from setuptools import find_packages
+from setuptools import setup
+
+import os
+
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+long_description = \
+ read('README.rst') + \
+ read('docs', 'CHANGELOG.rst') + \
+ read('docs', 'LICENSE.rst')
+
+setup(
+ name='niteoweb.ipn',
+ version='0.1',
+ description="Support for Instant Payment Notifications in Plone.",
+ long_description=long_description,
+ # Get more from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[
+ "Framework :: Plone",
+ "Programming Language :: Python",
+ ],
+ keywords='Plone IPN',
+ author='NiteoWeb Ltd.',
+ author_email='info@niteoweb.com',
+ url='defaultdict(<function <lambda> at 0x106cf0de8>, {})',
+ license='BSD',
+ packages=find_packages('src', exclude=['ez_setup']),
+ namespace_packages=['niteoweb'],
+ package_dir={'': 'src'},
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'five.grok',
+ 'five.pt',
+ 'Pillow',
+ 'Plone',
+ 'setuptools',
+ 'z3c.jbot',
+ ],
+ extras_require={
+ 'test': [
+ 'mock',
+ 'plone.app.testing',
+ 'unittest2',
+ ],
+ 'develop': [
+ 'flake8',
+ 'jarn.mkrelease',
+ 'niteoweb.loginas',
+ 'plone.app.debugtoolbar',
+ 'plone.reload',
+ 'Products.Clouseau',
+ 'Products.DocFinderTab',
+ 'Products.PDBDebugMode',
+ 'Products.PrintingMailHost',
+ 'Sphinx',
+ 'zest.releaser',
+ 'zptlint',
+ ],
+ },
+ entry_points="""
+ [z3c.autoinclude.plugin]
+ target = plone
+ """,
+)
6 src/niteoweb/__init__.py
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
10 src/niteoweb/ipn/__init__.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+"""Init and utils."""
+
+from zope.i18nmessageid import MessageFactory
+
+_ = MessageFactory('niteoweb.ipn')
+
+
+def initialize(context):
+ """Initializer called when used as a Zope 2 product."""
0 src/niteoweb/ipn/browser/__init__.py
No changes.
17 src/niteoweb/ipn/browser/configure.zcml
@@ -0,0 +1,17 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:plone="http://namespaces.plone.org/plone"
+ i18n_domain="niteoweb.ipn">
+
+ <!-- Set overrides folder for Just-a-Bunch-Of-Templates product -->
+ <include package="z3c.jbot" file="meta.zcml" />
+ <browser:jbot directory="overrides" layer="..interfaces.INiteowebIpnLayer" />
+
+ <!-- Publish static files -->
+ <browser:resourceDirectory
+ name="niteoweb.ipn"
+ directory="static"
+ />
+
+</configure>
0 src/niteoweb/ipn/browser/overrides/.gitignore
No changes.
0 src/niteoweb/ipn/browser/static/.gitignore
No changes.
31 src/niteoweb/ipn/configure.zcml
@@ -0,0 +1,31 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:cmf="http://namespaces.zope.org/cmf"
+ xmlns:five="http://namespaces.zope.org/five"
+ xmlns:grok="http://namespaces.zope.org/grok"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+ i18n_domain="niteoweb.ipn">
+
+ <!-- Zope2 initialization -->
+ <five:registerPackage package="." initialize=".initialize" />
+
+ <!-- Include configuration for dependencies listed in setup.py -->
+ <includeDependencies package="." />
+
+ <!-- Include sub-packages that use their own configure.zcml files. -->
+ <include package=".browser" />
+
+ <!-- Register all components defined with grok -->
+ <grok:grok package="." />
+
+ <!-- Register the installation GenericSetup extension profile -->
+ <genericsetup:registerProfile
+ name="default"
+ title="niteoweb.ipn"
+ directory="profiles/default"
+ description='Extension profile for niteoweb.ipn.'
+ provides="Products.GenericSetup.interfaces.EXTENSION"
+ />
+
+</configure>
8 src/niteoweb/ipn/interfaces.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+"""Module where all interfaces, events and exceptions live."""
+
+from plone.theme.interfaces import IDefaultPloneLayer
+
+
+class INiteowebIpnLayer(IDefaultPloneLayer):
+ """Marker interface that defines a Zope 3 browser layer."""
6 src/niteoweb/ipn/profiles/default/browserlayer.xml
@@ -0,0 +1,6 @@
+<layers>
+ <layer
+ name="niteoweb.ipn"
+ interface="niteoweb.ipn.interfaces.INiteowebIpnLayer"
+ />
+</layers>
3 src/niteoweb/ipn/profiles/default/metadata.xml
@@ -0,0 +1,3 @@
+<metadata>
+ <version>0.1.replace('.', '') + '00'</version>
+</metadata>
65 src/niteoweb/ipn/testing.py
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+"""Base module for unittesting."""
+
+from plone.app.testing import applyProfile
+from plone.app.testing import FunctionalTesting
+from plone.app.testing import IntegrationTesting
+from plone.app.testing import login
+from plone.app.testing import PLONE_FIXTURE
+from plone.app.testing import PloneSandboxLayer
+from plone.app.testing import setRoles
+from plone.app.testing import TEST_USER_ID
+from plone.app.testing import TEST_USER_NAME
+from plone.testing import z2
+
+import unittest2 as unittest
+
+
+class NiteowebIpnLayer(PloneSandboxLayer):
+
+ defaultBases = (PLONE_FIXTURE,)
+
+ def setUpZope(self, app, configurationContext):
+ """Set up Zope."""
+ # Load ZCML
+ import niteoweb.ipn
+ self.loadZCML(package=niteoweb.ipn)
+ z2.installProduct(app, 'niteoweb.ipn')
+
+ def setUpPloneSite(self, portal):
+ """Set up Plone."""
+ # Install into Plone site using portal_setup
+ applyProfile(portal, 'niteoweb.ipn:default')
+
+ # Login and create some test content
+ setRoles(portal, TEST_USER_ID, ['Manager'])
+ login(portal, TEST_USER_NAME)
+ portal.invokeFactory('Folder', 'folder')
+
+ # Commit so that the test browser sees these objects
+ portal.portal_catalog.clearFindAndRebuild()
+ import transaction
+ transaction.commit()
+
+ def tearDownZope(self, app):
+ """Tear down Zope."""
+ z2.uninstallProduct(app, 'niteoweb.ipn')
+
+
+FIXTURE = NiteowebIpnLayer()
+INTEGRATION_TESTING = IntegrationTesting(
+ bases=(FIXTURE,), name="NiteowebIpnLayer:Integration")
+FUNCTIONAL_TESTING = FunctionalTesting(
+ bases=(FIXTURE,), name="NiteowebIpnLayer:Functional")
+
+
+class IntegrationTestCase(unittest.TestCase):
+ """Base class for integration tests."""
+
+ layer = INTEGRATION_TESTING
+
+
+class FunctionalTestCase(unittest.TestCase):
+ """Base class for functional tests."""
+
+ layer = FUNCTIONAL_TESTING
0 src/niteoweb/ipn/tests/__init__.py
No changes.
38 src/niteoweb/ipn/tests/test_setup.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+"""Setup/installation tests for this package."""
+
+from niteoweb.ipn.testing import IntegrationTestCase
+from Products.CMFCore.utils import getToolByName
+
+import unittest2 as unittest
+
+
+class TestInstall(IntegrationTestCase):
+ """Test installation of niteoweb.ipn into Plone."""
+
+ def setUp(self):
+ """Custom shared utility setup for tests."""
+ self.portal = self.layer['portal']
+ self.installer = getToolByName(self.portal, 'portal_quickinstaller')
+
+ def test_product_installed(self):
+ """Test if niteoweb.ipn is installed with portal_quickinstaller."""
+ self.failUnless(self.installer.isProductInstalled('niteoweb.ipn'))
+
+ def test_uninstall(self):
+ """Test if niteoweb.ipn is cleanly uninstalled."""
+ self.installer.uninstallProducts(['niteoweb.ipn'])
+ self.failIf(self.installer.isProductInstalled('niteoweb.ipn'))
+
+ # browserlayer.xml
+ def test_browserlayer(self):
+ """Test that INiteowebIpnLayer is registered."""
+ from niteoweb.ipn.interfaces import INiteowebIpnLayer
+ from plone.browserlayer import utils
+ self.failUnless(INiteowebIpnLayer in utils.registered_layers())
+
+
+def test_suite():
+ """This sets up a test suite that actually runs the tests in the class
+ above."""
+ return unittest.defaultTestLoader.loadTestsFromName(__name__)

0 comments on commit f4e4ceb

Please sign in to comment.
Something went wrong with that request. Please try again.