Commits

Luke Plant committed 0eebbdd

Added setup files

Comments (0)

Files changed (7)

+#!/usr/bin/python
+"""
+Creates a source distribution from a project in this tree
+"""
+
+import sys
+import os
+import shutil
+
+SETUPDIR = 'setup'
+if len(sys.argv) == 1:
+    print """Usage:
+    python dist.py <projectname>
+    
+    where <projectname> is one of:    """
+    for d in os.listdir(os.path.realpath(SETUPDIR)):
+        if not d.startswith('.') and os.path.isdir(os.path.join(SETUPDIR,d)):
+            print "        " + d
+    
+    print
+else:
+    d = os.path.join(SETUPDIR, sys.argv[1])
+    if not os.path.isdir(d):
+        print "'%s' is not a directory in the setup folder."
+        exit(1)
+    
+    for f in ['setup.py', 'MANIFEST.in', 'README', 'AUTHORS']:
+        fullpath = os.path.join(d, f)
+        if os.path.isfile('../' + f):
+            os.unlink('../' + f)
+        if os.path.isfile(fullpath):
+            shutil.copy(fullpath, '../')
+    os.chdir('../')
+    os.system('python setup.py sdist --force-manifest')

setup/csrfmiddleware/README

+CsrfMiddleware
+==============
+
+Full documentation here:
+http://lukeplant.me.uk/resources/csrfmiddleware/
+
+
+Installation and usage
+======================
+Install the package using 'python setup.py install', or simply place the
+path of the extracted package into your python path. You then need to add 
+two lines to your Django settings file: 
+
+Add the middleware to your list of middleware classes, MIDDLEWARE_CLASSES.
+It needs to process the response after the SessionMiddleware, so must come
+before it in the list. It also must process the response before things like
+compression happen to the response, so it must come after GZipMiddleware
+(and similar). In my project it looks something like this: 
+ 
+MIDDLEWARE_CLASSES = (
+    "django.middleware.gzip.GZipMiddleware",
+    "lukeplant_me_uk.django.middleware.csrf.CsrfMiddleware",
+    "django.middleware.sessions.SessionMiddleware",
+)
+
+Add a setting CSRF_MIDDLEWARE_SECRET to your settings file. This must be a
+secret string which is used to do hashing, with a length equal to your
+paranoia.

setup/csrfmiddleware/setup.py

+#!/usr/bin/python
+from distutils.core import setup
+import sys
+
+if sys.version_info < (2, 3):
+    _setup = setup
+    def setup(**kwargs):
+        if kwargs.has_key("classifiers"):
+            del kwargs["classifiers"]
+        _setup(**kwargs)
+        
+classifiers = """\
+Development Status :: 5 - Production/Stable
+Environment :: Web Environment
+License :: OSI Approved :: MIT License
+Intended Audience :: Developers
+Operating System :: OS Independent
+Programming Language :: Python
+Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries
+"""
+
+setup(name = "csrfmiddleware",
+      author = "Luke Plant",
+      author_email = "L.Plant.98@cantab.net",
+      url = "http://lukeplant.me.uk/resources/crsfmiddleware/",
+      version = '1.1',
+      description = "A Django middleware to prevent Cross Site Request Forgery attacks.",
+      platforms = ["any"],
+      py_modules = [
+        'lukeplant_me_uk.__init__',
+        'lukeplant_me_uk.django.__init__',
+        'lukeplant_me_uk.django.middleware.__init__',
+        'lukeplant_me_uk.django.middleware.csrf',
+      ],
+      packages = [],
+      long_description = """\
+This Django middleware prevents Cross Site Request Forgery attacks
+by adding a token to outgoing POST forms and requiring its presence
+on all incoming POST requests where a session is active.
+""",
+      classifiers = filter(None, classifiers.split("\n")),
+      license = "http://www.opensource.org/licenses/mit-license",
+      
+      #      zip_safe = False,
+      #      namespace_packages = [
+      #        'lukeplant_me_uk',
+      #        'lukeplant_me_uk.django',
+      #        'lukeplant_me_uk.django.middleware',
+      #      ],
+)

setup/djangovalidator/AUTHORS

+Luke Plant <L.Plant.98@cantab.net>
+
+With thanks for contributions from:
+'nesh' <nesh _at_ studioquattro _dot_ co _dot_ yu>
+

setup/djangovalidator/MANIFEST.in

+recursive-include lukeplant_me_uk/django/apps/validator *.html
+include AUTHORS

setup/djangovalidator/README

+Django validator app
+==================== 
+
+Full docs at:
+  http://lukeplant.me.uk/resources/djangovalidator/
+
+
+Installation and usage
+======================
+- Run setup.py to install the package into your python path.
+- Add "lukeplant_me_uk.django.apps.validator" to your INSTALLED_APPS setting.
+- Add the folder <WHERE_YOU_INSTALLED_IT>/lukeplant_me_uk/django/apps/validator/templates
+  to your TEMPLATE_DIRS setting
+- Insert the middleware
+"lukeplant_me_uk.django.middleware.validator.ValidatorMiddleware" near the
+beginning of the middleware list (which means it will get the the response
+object after everything else). It must be after every middleware that does
+post-processing, but mustn't be after GZip, since it can't handle gzipped
+HTML. ( I just disable the GZip middleware for development)
+- Add a setting to tell the app where to find the 'validate' executable used
+for validation. This is a dictionary of mimetypes and corresponding
+validators, allowing this app to be extended to any other generated content: 
+VALIDATOR_APP_VALIDATORS = {
+    'text/html': '/usr/bin/validate',
+    'application/xml+xhtml': '/usr/bin/validate',
+}
+
+
+  If executables other than Liam Quinn's 'validate' are used, then ensure
+  they work in the same way: 
+   - they take a single argument which is the file to validate
+   - they print errors to standout output or standard error
+   - if there are no errors, they print nothing (like all good Unix programs)
+
+ 
+  The exit code is currently ignored, but 'validate' sets it correctly so it's
+  very easy to wrap it in a small shell script that does other things upon
+  failure like beep or display something on the screen. Like this one (the
+  second part requires KDE and assumes you are doing django-admin.py runserver
+  from a KDE session): 
+  #!/bin/sh
+        
+  validate $1 || 
+  { 
+        beep -l 5; 
+        dcop knotify default notify "validation failed" "django validator"
+         "invalid page found" "" "" 16 0 ;
+  }
+
+- Finally, run the django admin script to set up the database tables:
+  django-admin.py --settings="yourproject.settings" install validator 
+
+LICENSE
+=======
+MIT (which means in short that it is open source and free of charge for any
+use)
+
+Changelog
+=========
+Version 1.0 - 2005-11-19
+ - Initial release

setup/djangovalidator/setup.py

+#!/usr/bin/python
+
+# Don't use setuptools as I can't get it to work right
+# with Django at the moment
+from distutils.core import setup
+import sys
+
+# Work-around python < 2.3
+if sys.version_info < (2, 3):
+    _setup = setup
+    def setup(**kwargs):
+        if kwargs.has_key("classifiers"):
+            del kwargs["classifiers"]
+        _setup(**kwargs)
+
+classifiers = """\
+Development Status :: 5 - Production/Stable
+Environment :: Web Environment
+License :: OSI Approved :: MIT License
+Intended Audience :: Developers
+Operating System :: OS Independent
+Programming Language :: Python
+Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries
+Topic :: Software Development :: Testing
+"""
+
+setup(name = "djangovalidator",
+      author = "Luke Plant",
+      author_email = "L.Plant.98@cantab.net",
+      url = "http://lukeplant.me.uk/resources/djangovalidator/",
+      version = '1.1',
+      description = "A Django app and middleware for performing validation on outgoing HTML",
+      platforms = ["any"],
+      py_modules = [
+        'lukeplant_me_uk.__init__',
+        'lukeplant_me_uk.django.__init__',
+        'lukeplant_me_uk.django.middleware.__init__',
+        'lukeplant_me_uk.django.middleware.validator',
+        'lukeplant_me_uk.django.apps.__init__',
+        'lukeplant_me_uk.django.apps.validator.__init__',
+        'lukeplant_me_uk.django.apps.validator.urls',
+        'lukeplant_me_uk.django.apps.validator.views',
+        'lukeplant_me_uk.django.apps.validator.models.__init__',
+        'lukeplant_me_uk.django.apps.validator.models.validator',
+      ],
+      # Don't list higher level packages as otherwise all modules will be included
+      packages = ['lukeplant_me_uk.django.apps.validator'],
+      package_data = {'lukeplant_me_uk.django.apps.validator': ['templates/validator/*.html'] },
+      classifiers = filter(None, classifiers.split("\n")),
+      long_description = """\
+This app is intended to be plugged into a Django installation while
+it is being developped.  Using a external validator, all outgoing HTML
+is checked for validity and any failures are logged and can be browsed
+easily.
+""",
+
+      license = "http://www.opensource.org/licenses/mit-license",
+
+      #      namespace_packages = [
+      #        'lukeplant_me_uk',
+      #        'lukeplant_me_uk.django',
+      #        'lukeplant_me_uk.django.middleware',
+      #        'lukeplant_me_uk.django.apps',
+      #      ],
+      #      zip_safe = False,
+)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.