Permalink
Browse files

change documentation and small formatting changes

  • Loading branch information...
Christopher Zorn
Christopher Zorn committed May 4, 2011
1 parent a3c2d6f commit 91e1550a368a5a2bb52d9a0e52f7c4b11ef8753e
Showing with 37 additions and 32 deletions.
  1. +14 −11 INSTALL.txt
  2. +3 −0 punjab.tac
  3. +20 −19 punjab/__init__.py
  4. +0 −2 twisted/plugins/punjab_plugin.py
View
@@ -3,15 +3,15 @@ INSTALLING PUNJAB
=================
This document contains instructions on installing punjab
-on your system.
+on your system.
-------------
Obtaining Punjab
-------------
-Punjab can be located at the punjab web site,
+Punjab can be located at the punjab web site,
- http://code.stanziq.com/punjab
+ http://github.com/twonds/punjab
-------------
@@ -24,15 +24,15 @@ Please make sure all dependencies are met before submitting a troubleshooting qu
- Twisted >= 2.5
- - Twisted-names
+ - Twisted-names
- Twisted-words >= 0.6.0
- Twisted-web >= 0.5.0
Recommended
- Twisted-conch >= 0.5.0
- NOTE :
- You can download all of these packages with the Twisted Sumo package.
+ NOTE :
+ You can download all of these packages with the Twisted Sumo package.
http://twistedmatrix.com/
- pyopenssl - if you want tls to work.
@@ -44,16 +44,16 @@ Please make sure all dependencies are met before submitting a troubleshooting qu
Installing Punjab
-------------
-1. Untar the current punjab-X.X.tar.gz file in a directory you would
- like punjab to reside.
+1. Untar the current punjab-X.X.tar.gz file in a directory you would
+ like punjab to reside.
shell>tar vxzf punjab-X.X.tar.gz
2. Run setup to install
shell>python setup.py install
-3. Run punjab
+3. Run punjab
shell>twistd punjab
@@ -67,10 +67,13 @@ Run "twistd punjab --help" for options.
Extending Punjab
---------------------------
-You are able to extend punjab in many ways.
+You are able to extend punjab in many ways.
+
+For configuration flexibility you can use a .tac file. See punjab.tac for
+details.
-------------
Support
-------------
- http://code.stanziq.com/punjab
+ http://github.com/twonds/punjab
View
@@ -1,4 +1,6 @@
# punjab tac file
+# tac documentation is at the following URL:
+# http://twistedmatrix.com/documents/current/core/howto/application.html
from twisted.web import server, resource, static
from twisted.application import service, internet
@@ -25,3 +27,4 @@ site = server.Site(root)
application = service.Application("punjab")
internet.TCPServer(5280, site).setServiceParent(application)
+# To run this simply to twistd -y punjab.tac
View
@@ -2,11 +2,30 @@
Punjab - multiple http interfaces to jabber.
"""
-from twisted.python import log
+from OpenSSL import SSL
+
from twisted.application import service
+from twisted.internet import ssl
+from twisted.python import log
+
import patches
+
+# Override DefaultOpenSSLContextFactory to call ctx.use_certificate_chain_file
+# instead of ctx.use_certificate_file, to allow certificate chains to be loaded.
+class OpenSSLContextFactoryChaining(ssl.DefaultOpenSSLContextFactory):
+ def __init__(self, *args, **kwargs):
+ ssl.DefaultOpenSSLContextFactory.__init__(self, *args, **kwargs)
+
+ def cacheContext(self):
+ ctx = self._contextFactory(self.sslmethod)
+ ctx.set_options(SSL.OP_NO_SSLv2)
+ ctx.use_certificate_chain_file(self.certificateFileName)
+ ctx.use_privatekey_file(self.privateKeyFileName)
+ self._context = ctx
+
+
def uriCheck(elem, uri):
"""
This is a hack for older versions of twisted words, we need to get rid of it.
@@ -87,25 +106,7 @@ def makeService(config):
site = server.Site(r)
-
if config['ssl']:
- from twisted.internet import ssl
- from OpenSSL import SSL
-
- # Override DefaultOpenSSLContextFactory to call ctx.use_certificate_chain_file
- # instead of ctx.use_certificate_file, to allow certificate chains to be loaded.
- class OpenSSLContextFactoryChaining(ssl.DefaultOpenSSLContextFactory):
- def __init__(self, *args, **kwargs):
- ssl.DefaultOpenSSLContextFactory.__init__(self, *args, **kwargs)
-
- def cacheContext(self):
- ctx = self._contextFactory(self.sslmethod)
- ctx.set_options(SSL.OP_NO_SSLv2)
- ctx.use_certificate_chain_file(self.certificateFileName)
- ctx.use_privatekey_file(self.privateKeyFileName)
- self._context = ctx
-
-
ssl_context = OpenSSLContextFactoryChaining(config['ssl_privkey'],
config['ssl_cert'],
SSL.SSLv23_METHOD,)
@@ -2,8 +2,6 @@
from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
-from twisted.application import internet
-from twisted.python import usage
# Due to the directory layout, and the fact that plugin directories aren't
# modules (no __init__.py), this file is named something other than punjab.py,

0 comments on commit 91e1550

Please sign in to comment.