Skip to content

/ Zope / gocept svn checkins / Archive / 2008 / 2008-10 / SVN: r6893 - in gocept.plone.attributecondition/trunk: . gocept gocept/plone gocept/plone/attributecondition

[ << ] [ >> ]

[ SVN: r6878 - in gocept.vendo/branches/paypal/src/g... ] [ SVN: r6894 - gocept.vendo/branches/paypal / ... ]

SVN: r6893 - in gocept.plone.attributecondition/trunk: . gocept gocept/plone gocept/plone/attributecondition
Sebastian Wehrmann <sw(at)gocept.com>
2008-10-23 15:24:05 [ FULL ]
Author: sweh
Date: Thu Oct 23 15:23:58 2008
New Revision: 6893

Log:
boilerplate



Added:
   gocept.plone.attributecondition/trunk/CHANGES.txt   (contents, props
changed)
   gocept.plone.attributecondition/trunk/bootstrap.py   (contents, props
changed)
   gocept.plone.attributecondition/trunk/buildout.cfg
   gocept.plone.attributecondition/trunk/gocept/
   gocept.plone.attributecondition/trunk/gocept/__init__.py   (contents, props
changed)
   gocept.plone.attributecondition/trunk/gocept/plone/
   gocept.plone.attributecondition/trunk/gocept/plone/__init__.py   (contents,
props changed)
   gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/
  
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/README.txt
  (contents, props changed)
  
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/__init__.py
  (contents, props changed)
  
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/tests.py 
 (contents, props changed)
   gocept.plone.attributecondition/trunk/setup.py   (contents, props changed)
Modified:
   gocept.plone.attributecondition/trunk/   (props changed)

Added: gocept.plone.attributecondition/trunk/CHANGES.txt
==============================================================================

Added: gocept.plone.attributecondition/trunk/bootstrap.py
==============================================================================
--- (empty file)
+++ gocept.plone.attributecondition/trunk/bootstrap.py	Thu Oct 23 15:23:58 2008
(at)(at) -0,0 +1,55 (at)(at)
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation 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.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+    import pkg_resources
+except ImportError:
+    ez = {}
+    exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                         ).read() in ez
+    ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+    import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)

Added: gocept.plone.attributecondition/trunk/buildout.cfg
==============================================================================
--- (empty file)
+++ gocept.plone.attributecondition/trunk/buildout.cfg	Thu Oct 23 15:23:58 2008
(at)(at) -0,0 +1,8 (at)(at)
+[buildout]
+parts = test
+develop = .
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = gocept.plone.attributecondition
+defaults = ['-vv', '--all', '--color']

Added: gocept.plone.attributecondition/trunk/gocept/__init__.py
==============================================================================
--- (empty file)
+++ gocept.plone.attributecondition/trunk/gocept/__init__.py	Thu Oct 23
15:23:58 2008
(at)(at) -0,0 +1,6 (at)(at)
+# 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__)

Added: gocept.plone.attributecondition/trunk/gocept/plone/__init__.py
==============================================================================
--- (empty file)
+++ gocept.plone.attributecondition/trunk/gocept/plone/__init__.py	Thu Oct 23
15:23:58 2008
(at)(at) -0,0 +1,6 (at)(at)
+# 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__)

Added:
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/README.txt
==============================================================================

Added:
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/__init__.py
==============================================================================
--- (empty file)
+++
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/__init__.py	Thu
Oct 23 15:23:58 2008
(at)(at) -0,0 +1,58 (at)(at)
+# -*- coding: utf-8 -*-
+"""Recipe deploymentsandbox"""
+
+import os
+import os.path
+
+
+SANDBOX_DIRS = {
+    'etc-directory': 'etc/%(name)s',
+    'log-directory': 'var/log/%(name)s',
+    'run-directory': 'var/run/%(name)s',
+    'crontab-directory': 'etc/cron.d',
+    'logrotate-directory': 'etc/logrotate.d',
+    'rc-directory': 'etc/init.d',
+}
+
+# Make directory paths platform independent
+SANDBOX_DIRS = dict((name, path.split('/'))
+                    for (name, path) in SANDBOX_DIRS.items())
+
+
+class Recipe(object):
+    """zc.buildout recipe"""
+
+    def __init__(self, buildout, name, options):
+        self.buildout, self.name, self.options = buildout, name, options
+
+        if options.get('name', None) is None:
+            options['name'] = name
+
+        options['user'] = os.environ['LOGNAME']
+
+        self.root = self.options.get(
+            'root',
+            os.path.join(self.buildout['buildout']['parts-directory'],
+                         self.name))
+
+        # Compute zc.recipe.deployment-compatible options.
+        # This needs to happen early so that other recipes can pick those
paths up.
+        for option, path in SANDBOX_DIRS.items():
+            options[option] = os.path.join(self.root, *path) % options
+
+    def install(self):
+        """Installer"""
+        # Create sandbox directories
+        for option in SANDBOX_DIRS:
+            target = self.options[option]
+            if not os.path.isdir(target):
+                os.makedirs(target)
+
+        # We do not notify buildout about the created directories to avoid
+        # deleting data.
+        return tuple()
+
+    def update(self):
+        """Updater"""
+        # Just make sure that all directories are still there.
+        self.install()

Added:
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/tests.py
==============================================================================
--- (empty file)
+++
gocept.plone.attributecondition/trunk/gocept/plone/attributecondition/tests.py	Thu
Oct 23 15:23:58 2008
(at)(at) -0,0 +1,14 (at)(at)
+# Copyright (c) 2007-2008 gocept gmbh & co. kg
+# See also LICENSE.txt
+# $Id$
+
+import unittest
+
+from zope.testing import doctest
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(doctest.DocFileSuite("README.txt",
+                                       optionflags=doctest.ELLIPSIS))
+    return suite

Added: gocept.plone.attributecondition/trunk/setup.py
==============================================================================
--- (empty file)
+++ gocept.plone.attributecondition/trunk/setup.py	Thu Oct 23 15:23:58 2008
(at)(at) -0,0 +1,40 (at)(at)
+from setuptools import setup, find_packages
+import os.path
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+version = '0.1'
+
+setup(name='gocept.plone.attributecondition',
+      version=version,
+      description="A condition for Plone 3's content rules that checks
attribute values on a content item.",
+      long_description = (read('gocept', 'plone', 'attributecondition',
+                               'README.txt')
+                          + '\n\n' +
+                          read('CHANGES.txt')
+      ),
+      classifiers=[
+          "Framework :: Plone",
+          "Framework :: Zope2",
+          "Framework :: Zope3",
+          "Programming Language :: Python",
+          "Topic :: Software Development :: Libraries :: Python Modules",
+      ],
+      keywords='Plone content rules attribute',
+      author='Sebastian Wehrmann',
+      author_email='sw(at)gocept.com',
+      url='http://pypi.python.org/pypi/gocept.plone.attributecondition/',
+      license='ZPL 2.1',
+      packages=find_packages(exclude=['ez_setup']),
+      namespace_packages=['gocept', 'gocept.plone'],
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=[
+          'setuptools',
+          # -*- Extra requirements: -*-
+      ],
+      entry_points="""
+      # -*- Entry points: -*-
+      """,
+      )

SVN: r6899 - in gocept.plone.efsaction/trunk: . gocept gocept/plone gocept/plone/efsaction
Daniel Havlik <dh(at)gocept.com>
2008-10-24 10:37:02 [ FULL ]
Author: nilo
Date: Fri Oct 24 10:37:00 2008
New Revision: 6899

Log:
first version of the efs content action



Added:
   gocept.plone.efsaction/trunk/CHANGES.txt   (contents, props changed)
   gocept.plone.efsaction/trunk/gocept/
   gocept.plone.efsaction/trunk/gocept/__init__.py   (contents, props changed)
   gocept.plone.efsaction/trunk/gocept/plone/
   gocept.plone.efsaction/trunk/gocept/plone/__init__.py   (contents, props
changed)
   gocept.plone.efsaction/trunk/gocept/plone/efsaction/
   gocept.plone.efsaction/trunk/gocept/plone/efsaction/__init__.py   (contents,
props changed)
   gocept.plone.efsaction/trunk/gocept/plone/efsaction/configure.zcml  
(contents, props changed)
   gocept.plone.efsaction/trunk/gocept/plone/efsaction/efs.py   (contents,
props changed)
   gocept.plone.efsaction/trunk/gocept/plone/efsaction/interfaces.py  
(contents, props changed)
   gocept.plone.efsaction/trunk/setup.py   (contents, props changed)

Added: gocept.plone.efsaction/trunk/CHANGES.txt
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/CHANGES.txt	Fri Oct 24 10:37:00 2008
(at)(at) -0,0 +1,4 (at)(at)
+Changes
+=======
+
+0.1 Unreleased

Added: gocept.plone.efsaction/trunk/gocept/__init__.py
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/gocept/__init__.py	Fri Oct 24 10:37:00 2008
(at)(at) -0,0 +1,6 (at)(at)
+# 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__)

Added: gocept.plone.efsaction/trunk/gocept/plone/__init__.py
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/gocept/plone/__init__.py	Fri Oct 24 10:37:00
2008
(at)(at) -0,0 +1,6 (at)(at)
+# 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__)

Added: gocept.plone.efsaction/trunk/gocept/plone/efsaction/__init__.py
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/gocept/plone/efsaction/__init__.py	Fri Oct 24
10:37:00 2008
(at)(at) -0,0 +1,2 (at)(at)
+def initialize(context):
+    pass

Added: gocept.plone.efsaction/trunk/gocept/plone/efsaction/configure.zcml
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/gocept/plone/efsaction/configure.zcml	Fri Oct
24 10:37:00 2008
(at)(at) -0,0 +1,34 (at)(at)
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:five="http://namespaces.zope.org/five"
+    xmlns:plone="http://namespaces.plone.org/plone"
+    xmlns:browser="http://namespaces.zope.org/browser">
+
+    <five:registerPackage package="." initialize=".initialize" />
+
+    <adapter factory=".efs.EFSActionExecutor" />
+
+    <browser:page
+        for="plone.app.contentrules.browser.interfaces.IRuleActionAdding"
+        name="plone.actions.EFS"
+        class=".efs.EFSAddForm"
+        permission="cmf.ManagePortal" />
+
+    <browser:page
+        for=".interfaces.IEFSAction"
+        name="edit"
+        class=".efs.EFSEditForm"
+        permission="cmf.ManagePortal" />
+
+    <plone:ruleAction
+        name="plone.actions.EFS"
+        title="Create an EFS order"
+        description="Create an EFS order from the triggering object"
+        for="*"
+        event="zope.component.interfaces.IObjectEvent"
+        addview="plone.actions.EFS"
+        editview="edit"
+        schema=".interfaces.IEFSAction"
+        factory=".efs.EFSAction" />
+
+</configure>

Added: gocept.plone.efsaction/trunk/gocept/plone/efsaction/efs.py
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/gocept/plone/efsaction/efs.py	Fri Oct 24
10:37:00 2008
(at)(at) -0,0 +1,83 (at)(at)
+import OFS.SimpleItem
+import Acquisition
+import Products.CMFCore.utils
+
+import plone.contentrules.rule.interfaces
+import plone.app.contentrules.browser.formhelper
+
+import gocept.plone.efsaction.interfaces
+import gocept.efs.efs
+
+import zope.interface
+import zope.component
+import zope.formlib
+
+import zope.tales.engine
+import zope.tales.tales
+
+
+class EFSAction(OFS.SimpleItem.SimpleItem):
+    """Implementation of the efs action"""
+    zope.interface.implements(gocept.plone.efsaction.interfaces.IEFSAction, 
+            plone.contentrules.rule.interfaces.IRuleElementData)
+
+    merchant_id = u''
+    merchant_name = u''
+    storage_path = u''
+
+    element = 'plone.actions.EFS'
+
+    (at)property
+    def summary(self):
+        return u"Create EFS orders for merchant %s (%s) in %s" %
(self.merchant_name,
+                                                               
self.merchant_id,
+                                                               
self.storage_path)
+
+
+class EFSActionExecutor(object):
+    """Executor for the efs action"""
+    zope.interface.implements(plone.contentrules.rule.interfaces.IExecutable)
+    zope.component.adapts(zope.interface.Interface,
+            gocept.plone.efsaction.interfaces.IEFSAction,
+            zope.interface.Interface)
+
+    def __init__(self, context, element, event):
+        self.context = context
+        self.element = element
+        self.event = event
+
+    def __call__(self):
+        urltool = Products.CMFCore.utils.getToolByName(
+                Acquisition.aq_inner(self.context), "portal_url")
+        portal = urltool.getPortalObject()
+        merchant_id = self.element.merchant_id
+        merchant_name = self.element.merchant_name
+        storage_path = self.element.storage_path
+        efs = gocept.efs.efs.Efs(merchant_id, merchant_name, storage_path)
+        obj = self.event.object
+        return efs.create_order(obj)
+
+
+class EFSAddForm(plone.app.contentrules.browser.formhelper.AddForm):
+    """Addform for the efs action"""
+    form_fields = zope.formlib.form.FormFields(
+            gocept.plone.efsaction.interfaces.IEFSAction)
+    label = u"Add EFS Action"
+    description = u"EFS Action lets you send an "\
+            "order to efulfillment.com"
+    form_name = u"Configure element"
+
+    def create(self, data):
+        efs_action = EFSAction()
+        zope.formlib.form.applyChanges(efs_action, self.form_fields, data)
+        return efs_action
+
+
+class EFSEditForm(plone.app.contentrules.browser.formhelper.EditForm):
+    """Editform for the efs action"""
+    form_fields = zope.formlib.form.FormFields(
+            gocept.plone.efsaction.interfaces.IEFSAction)
+    label = u"Edit EFS Action"
+    description = u"EFS Action lets you send an "\
+            "order to efulfillment.com"
+    form_name = u"Configure element"

Added: gocept.plone.efsaction/trunk/gocept/plone/efsaction/interfaces.py
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/gocept/plone/efsaction/interfaces.py	Fri Oct
24 10:37:00 2008
(at)(at) -0,0 +1,18 (at)(at)
+import zope.interface
+import zope.schema
+
+class IEFSAction(zope.interface.Interface):
+    """Definition of the fields available on an efs action"""
+    merchant_id = zope.interface.Attribute('Merchant ID')
+    merchant_name = zope.interface.Attribute('Merchat name')
+    storage_path = zope.interface.Attribute('Storage path')
+
+    merchant_id = zope.schema.TextLine(title=u"Merchant id",
+                            description=u"Your merchant id at
efulfillment.com",
+                            required=True)
+    merchant_name = zope.schema.TextLine(title=u"Merchant name",
+                          description=u"Your merchant name at
efulfillment.com",
+                            required=True)
+    storage_path = zope.schema.TextLine(title=u"Storage Path",
+                            description=u"An existing path where to store the
xml files",
+                            required=True)

Added: gocept.plone.efsaction/trunk/setup.py
==============================================================================
--- (empty file)
+++ gocept.plone.efsaction/trunk/setup.py	Fri Oct 24 10:37:00 2008
(at)(at) -0,0 +1,34 (at)(at)
+from setuptools import setup, find_packages
+
+version = '0.1dev'
+
+setup(name='gocept.plone.efsaction',
+      version=version,
+      description="efulfillment.com action for plone contentactions",
+      long_description="""\
+""",
+      # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+      classifiers=[
+        "Framework :: Plone",
+        "Framework :: Zope2",
+        "Framework :: Zope3",
+        "Programming Language :: Python",
+        "Topic :: Software Development :: Libraries :: Python Modules",
+        ],
+      keywords='',
+      author='Daniel Havlik',
+      author_email='dh(at)gocept.com',
+      url='',
+      license='GPL',
+      packages=find_packages(exclude=['ez_setup']),
+      namespace_packages=['gocept', 'gocept.plone'],
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=[
+          'setuptools',
+          # -*- Extra requirements: -*-
+      ],
+      entry_points="""
+      # -*- Entry points: -*-
+      """,
+      )

MailBoxer