Skip to content
Browse files

ooops, now we commit all these nice new files. The last bit was just …

…the buildout. I'll get used to git eventually :/
  • Loading branch information...
1 parent 3108e04 commit 3961c471bda1a7a7289093ffa025c917b2f1172d @cewing cewing committed
View
0 src/eastofeaton/pay2plone/browser/__init__.py
No changes.
View
0 src/eastofeaton/pay2plone/browser/configure.zcml
No changes.
View
19 src/eastofeaton/pay2plone/configure.zcml
@@ -0,0 +1,19 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="eastofeaton.pay2plone">
+
+ <!-- <five:registerPackage package="." initialize=".initialize" /> -->
+
+ <genericsetup:registerProfile
+ name="default"
+ title="eastofeaton.pay2plone"
+ directory="profiles/default"
+ description="Installs the eastofeaton.pay2plone package"
+ provides="Products.GenericSetup.interfaces.EXTENSION"
+ />
+
+</configure>
View
37 src/eastofeaton/pay2plone/interfaces.py
@@ -0,0 +1,37 @@
+from zope.interface import Interface
+from zope.schema import TextLine
+from zope.schema import Text
+from zope.schema import Decimal
+from zope.schema import FrozenSet
+from zope.schema import Choice
+from zope.schema.vocabulary import SimpleTerm
+from zope.schema.vocabulary import SimpleVocabulary
+
+
+class ISiteTemplate(Interface):
+ """ describes the template for creating a site
+ """
+ name = TextLine(title=u'Template Name',
+ required=True)
+ description = Text(title=u"Template Description",
+ description=u"The description of this template shown to users",
+ required=True)
+ price = Decimal(title=u"Template Price",
+ description=u"The price users will be charged per subscription period for a site built from this template",
+ required=True)
+ products = FrozenSet(title=u"Installed Products",
+ description=u"Choose the products to install when creating a site from this template",
+ required=True,
+ value_type=Choice(
+ vocabulary=SimpleVocabulary((
+ SimpleTerm(token='Foo', value='foo'),
+ SimpleTerm(token='Bar', value='bar'),
+ SimpleTerm(token='Baz', value='baz'),
+ )),
+ ),
+ default=frozenset(['foo',]))
+
+
+class IPay2PloneUtility(Interface):
+ """ contract interface for the pay2plone utility
+ """
View
9 src/eastofeaton/pay2plone/profiles/default/componentregistry.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<componentregistry>
+ <utilities>
+ <utility
+ interface="eastofeaton.pay2plone.interfaces.IPay2PloneUtility"
+ factory="eastofeaton.pay2plone.utility.Pay2PloneUtility"
+ />
+ </utilities>
+</componentregistry>
View
4 src/eastofeaton/pay2plone/profiles/default/metadata.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<metadata>
+ <version>0001</version>
+</metadata>
View
22 src/eastofeaton/pay2plone/sitetemplate.py
@@ -0,0 +1,22 @@
+from persistent import Persistent
+
+from zope.interface import implements
+
+from eastofeaton.pay2plone.interfaces import ISiteTemplate
+
+
+class SiteTemplate(Persistent):
+ """ a template for a purchaseable site
+ """
+ implements(ISiteTemplate)
+
+ name = u''
+ description = None
+ price = 0.0
+ products = None
+
+ def __init__(self, name, description, price, products=[]):
+ self.name = name
+ self.description = description
+ self.price = price
+ self.products = frozenset(products)
View
31 src/eastofeaton/pay2plone/testing.py
@@ -0,0 +1,31 @@
+from plone.app.testing import PLONE_FIXTURE
+from plone.app.testing import PloneSandboxLayer
+from plone.app.testing import IntegrationTesting
+from plone.app.testing import FunctionalTesting
+from plone.app.testing import applyProfile
+
+from zope.configuration import xmlconfig
+
+
+class EastofeatonPay2Plone(PloneSandboxLayer):
+
+ defaultBases = (PLONE_FIXTURE, )
+
+ def setUpZope(self, app, configurationContext):
+
+ # Load ZCML
+ import eastofeaton.pay2plone
+ xmlconfig.file('configure.zcml',
+ eastofeaton.pay2plone,
+ context=configurationContext)
+
+ def setUpPloneSite(self, portal):
+ applyProfile(portal, 'eastofeaton.pay2plone:default')
+
+EASTOFEATON_PAY2PLONE_FIXTURE = EastofeatonPay2Plone()
+EASTOFEATON_PAY2PLONE_INTEGRATION_TESTING = \
+ IntegrationTesting(bases=(EASTOFEATON_PAY2PLONE_FIXTURE, ),
+ name="EastofeatonPay2Plone:Integration")
+EASTOFEATON_PAY2PLONE_FUNCTIONAL_TESTING = \
+ FunctionalTesting(bases=(EASTOFEATON_PAY2PLONE_FIXTURE, ),
+ name="EastofeatonPay2Plone:Functional")
View
0 src/eastofeaton/pay2plone/tests/__init__.py
No changes.
View
37 src/eastofeaton/pay2plone/tests/test_setup.py
@@ -0,0 +1,37 @@
+import unittest2 as unittest
+
+# from plone.app.testing import TEST_USER_ID, TEST_USER_PASSWORD
+# from plone.app.testing import applyProfile
+# from plone.app.testing import setRoles
+from zope.component import queryUtility
+
+from Products.CMFCore.utils import getToolByName
+
+from eastofeaton.pay2plone.interfaces import IPay2PloneUtility
+from eastofeaton.pay2plone.testing import\
+ EASTOFEATON_PAY2PLONE_INTEGRATION_TESTING
+
+
+class TestSetup(unittest.TestCase):
+
+ layer = EASTOFEATON_PAY2PLONE_INTEGRATION_TESTING
+
+ def setUp(self):
+ self.app = self.layer['app']
+ self.portal = self.layer['portal']
+ self.qi_tool = getToolByName(self.portal, 'portal_quickinstaller')
+ self.cp = getToolByName(self.portal, 'portal_controlpanel')
+
+ def test_product_installed(self):
+ """ validate that our product GS profile has been run and installed
+ """
+ pid = 'eastofeaton.pay2plone'
+ installed = [p['id'] for p in self.qi_tool.listInstalledProducts()]
+ self.assertTrue(pid in installed,
+ "Package appears not to be installed")
+
+ def test_utility_available(self):
+ """ validate that the utility exists and can be found
+ """
+ utility = queryUtility(IPay2PloneUtility)
+ self.assert_(utility)
View
7 src/eastofeaton/pay2plone/utility.py
@@ -0,0 +1,7 @@
+from persistent import Persistent
+# from BTrees.IOBTree
+
+class Pay2PloneUtility(Persistent):
+ """ a persistent utility which stores configuration and user information
+ """
+

0 comments on commit 3961c47

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