Commits

Anthony Tuininga committed 2676761

Added support for a Zope sample which makes use of namespace packages.

Comments (0)

Files changed (2)

samples/zope/qotd.py

+#!/usr/bin/env /usr/bin/python
+"""A simple Quote of the Day server"""
+from twisted.internet.protocol import Protocol, Factory
+from twisted.internet import reactor
+
+class QOTD(Protocol):
+
+    def connectionMade(self):
+        self.transport.write("An apple a day keeps the doctor away\r\n") 
+        self.transport.loseConnection()
+
+# Next lines are magic:
+factory = Factory()
+factory.protocol = QOTD
+
+# 8007 is the port you want to run under. Choose something >1024
+reactor.listenTCP(8007, factory)
+reactor.run()

samples/zope/setup.py

+# A simple setup script to create an executable using Zope which demonstrates
+# the use of namespace packages.
+#
+# qotd.py is a very simple type of Zope application
+#
+# Run the build process by running the command 'python setup.py build'
+#
+# If everything works well you should find a subdirectory in the build
+# subdirectory that contains the files needed to run the application
+
+import sys
+
+from cx_Freeze import setup, Executable
+
+buildOptions = dict(
+        namespace_packages = ['zope'])
+
+setup(
+        name = "QOTD sample",
+        version = "1.0",
+        description = "QOTD sample for demonstrating use of namespace packages",
+        options = dict(build_exe = buildOptions),
+        executables = [Executable("qotd.py")])
+