[Checkins] SVN: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/ added

Andreas Jung andreas at andreas-jung.com
Sat May 16 01:18:57 EDT 2009


Log message for revision 99996:
  added
  

Changed:
  U   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/__init__.py
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.py
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.txt
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app_templates/
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app_templates/index.pt
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/configure.zcml
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/ftesting.zcml
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/static/
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/static/README.txt
  A   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/tests.py

-=-
Modified: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/__init__.py
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/__init__.py	2009-05-16 05:18:04 UTC (rev 99995)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/__init__.py	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1 @@
+# this directory is a package

Added: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.py
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.py	                        (rev 0)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.py	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1,7 @@
+import grok
+
+class Zopyx_smartprintng_server(grok.Application, grok.Container):
+    pass
+
+class Index(grok.View):
+    pass # see app_templates/index.pt

Added: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.txt
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.txt	                        (rev 0)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app.txt	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1,32 @@
+Do a functional doctest test on the app.
+========================================
+
+:Test-Layer: functional
+
+Let's first create an instance of Zopyx_smartprintng_server at the top level:
+
+   >>> from zopyx_smartprintng_server.app import Zopyx_smartprintng_server
+   >>> root = getRootFolder()
+   >>> root['app'] = Zopyx_smartprintng_server()
+
+
+Run tests in the testbrowser
+----------------------------
+
+The zope.testbrowser.browser module exposes a Browser class that
+simulates a web browser similar to Mozilla Firefox or IE.  We use that
+to test how our application behaves in a browser.  For more
+information, see http://pypi.python.org/pypi/zope.testbrowser.
+
+Create a browser and visit the instance you just created:
+
+   >>> from zope.testbrowser.testing import Browser
+   >>> browser = Browser()
+   >>> browser.open('http://localhost/app')
+
+Check some basic information about the page you visit:
+
+   >>> browser.url
+   'http://localhost/app'
+   >>> browser.headers.get('Status').upper()
+   '200 OK'

Added: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app_templates/index.pt
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app_templates/index.pt	                        (rev 0)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/app_templates/index.pt	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1,11 @@
+<html>
+<head>
+</head>
+<body>
+  <h1>Congratulations!</h1>
+
+  <p>Your Grok application is up and running.
+  Edit <code>zopyx_smartprintng_server/app_templates/index.pt</code> to change
+  this page.</p>
+</body>
+</html>

Added: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/configure.zcml
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/configure.zcml	                        (rev 0)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/configure.zcml	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1,6 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:grok="http://namespaces.zope.org/grok">
+  <include package="grok" />
+  <includeDependencies package="." />
+  <grok:grok package="." />
+</configure>

Added: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/ftesting.zcml
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/ftesting.zcml	                        (rev 0)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/ftesting.zcml	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1,34 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   i18n_domain="zopyx_smartprintng_server"
+   package="zopyx_smartprintng_server"
+   >
+
+  <include package="zopyx_smartprintng_server" />
+
+  <!-- Typical functional testing security setup -->
+  <securityPolicy
+      component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+      />
+
+  <unauthenticatedPrincipal
+      id="zope.anybody"
+      title="Unauthenticated User"
+      />
+  <grant
+      permission="zope.View"
+      principal="zope.anybody"
+      />
+
+  <principal
+      id="zope.mgr"
+      title="Manager"
+      login="mgr"
+      password="mgrpw"
+      />
+
+  <role id="zope.Manager" title="Site Manager" />
+  <grantAll role="zope.Manager" />
+  <grant role="zope.Manager" principal="zope.mgr" />
+
+</configure>

Added: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/static/README.txt
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/static/README.txt	                        (rev 0)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/static/README.txt	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1,2 @@
+Put static files here, like javascript and css.  They will be
+available as static/<filename> in views.

Added: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/tests.py
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/tests.py	                        (rev 0)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/tests.py	2009-05-16 05:18:57 UTC (rev 99996)
@@ -0,0 +1,12 @@
+import os.path
+import z3c.testsetup
+import zopyx_smartprintng_server
+from zope.app.testing.functional import ZCMLLayer
+
+
+ftesting_zcml = os.path.join(
+    os.path.dirname(zopyx_smartprintng_server.__file__), 'ftesting.zcml')
+FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer',
+                            allow_teardown=True)
+
+test_suite = z3c.testsetup.register_all_tests('zopyx_smartprintng_server')



More information about the Checkins mailing list