Skip to content
Browse files

first cut at conversion from repoze.virginia

  • Loading branch information...
1 parent b2dee93 commit 736e8cc68e71498e27dbab595b8af37cfac36f33 @mcdonc mcdonc committed Nov 21, 2010
View
14 .gitignore
@@ -0,0 +1,14 @@
+*.egg
+*.egg-info
+*.pyc
+*$py.class
+*.pt.py
+*.txt.py
+.coverage
+env26/
+env24/
+env27/
+jyenv/
+pypyenv/
+build/
+dist/
View
13 CHANGES.txt
@@ -1,13 +1,6 @@
-Next release
-============
-
-- Update tests to run under BFG 1.3.
+0.0
+===
-- Added ``file_class`` attribute which lets subclasses of the
- directory class define which file class to instantiate upon
- traversal.
+- Forked from repoze.virginia after 0.1.
-0.1
-===
-- Initial release.
View
2 COPYRIGHT.txt
@@ -1,3 +1,3 @@
-Copyright (c) 2008 Agendaless Consulting and Contributors.
+Copyright (c) 2010 Agendaless Consulting and Contributors.
(http://www.agendaless.com), All Rights Reserved
View
8 README.txt
@@ -1,5 +1,5 @@
-repoze.virginia README
-======================
+virginia README
+===============
-This package provides a WSGI application that is willing to serve
-slightly dynamic file content from a disk directory.
+This package provides a Pyramid application that is willing to serve slightly
+dynamic file content from a disk directory.
View
13 development.ini
@@ -0,0 +1,13 @@
+[app:virginia1]
+use = egg:virginia
+root = %(here)s/content
+
+[pipeline:main]
+pipeline =
+ egg:WebError
+ virginia1
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 6543
View
1 repoze/__init__.py
@@ -1 +0,0 @@
-__import__('pkg_resources').declare_namespace(__name__)
View
18 repoze/virginia/__init__.py
@@ -1,18 +0,0 @@
-# publish a filesystem tree
-
-def make_app(global_config, root=None):
- if root is None:
- raise ValueError('repoze.virginia requires a root')
- import os
- from repoze.virginia.models import Directory
- from repoze.virginia.models import Filesystem
- fs = Filesystem(os.path.abspath(os.path.normpath(root)))
- def get_root(environ):
- return Directory(fs, root)
- from repoze.bfg.configuration import Configurator
- config = Configurator(root_factory=get_root)
- config.begin()
- config.load_zcml('repoze.virginia:configure.zcml')
- config.end()
- return config.make_wsgi_app()
-
View
17 sample-virginia.ini
@@ -1,17 +0,0 @@
-[DEFAULT]
-debug = True
-
-[app:virginia]
-use = egg:repoze.virginia#virginia
-root = %(here)s/content
-
-[pipeline:main]
-pipeline =
- egg:Paste#cgitb
- egg:Paste#httpexceptions
- virginia
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 6543
View
4 setup.cfg
@@ -3,7 +3,7 @@ zip_ok = 0
[nosetests]
match=^test
-where=repoze/virginia
+where=virginia
nocapture=1
-cover-package=repoze.virginia
+cover-package=virginia
cover-erase=1
View
23 setup.py
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2008 Agendaless Consulting and Contributors.
+# Copyright (c) 2010 Agendaless Consulting and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the BSD-like license at
@@ -12,7 +12,7 @@
#
##############################################################################
-__version__ = '0.3dev'
+__version__ = '0.0'
import os
from setuptools import setup, find_packages
@@ -22,13 +22,15 @@
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
- 'repoze.bfg',
+ 'pyramid',
+ 'PasteScript',
+ 'WebError',
'zope.structuredtext',
]
-setup(name='repoze.virginia',
+setup(name='virginia',
version=__version__,
- description='Serve filesystem content via repoze.bfg',
+ description='Serve slightly dynamic filesystem content via Pyramid',
long_description=README + '\n\nCHANGES\n\n' + CHANGES,
classifiers=[
"Development Status :: 4 - Beta",
@@ -39,21 +41,20 @@
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
],
- keywords='file server wsgi zope',
+ keywords='file server pyramid pylons',
author="Agendaless Consulting",
- author_email="repoze-dev@lists.repoze.org",
- url="http://www.repoze.org",
+ author_email="pylons-devel@googlegroups.com",
+ url="http://docs.pylonshq.com",
license="BSD-derived (http://www.repoze.org/LICENSE.txt)",
packages=find_packages(),
include_package_data=True,
- namespace_packages=['repoze'],
zip_safe=False,
tests_require = requires,
install_requires = requires,
- test_suite="repoze.virginia.tests",
+ test_suite="virginia.tests",
entry_points = """\
[paste.app_factory]
- virginia = repoze.virginia:make_app
+ main = virginia:main
""",
)
View
18 virginia/__init__.py
@@ -0,0 +1,18 @@
+import os
+
+from pyramid.configuration import Configurator
+
+from virginia.models import Directory
+from virginia.models import Filesystem
+
+def main(global_config, **settings):
+ root = settings.pop('root', None)
+ if root is None:
+ raise ValueError('virginia requires a root')
+ fs = Filesystem(os.path.abspath(os.path.normpath(root)))
+ def get_root(environ):
+ return Directory(fs, root)
+ config = Configurator(root_factory=get_root, settings=settings)
+ config.load_zcml('virginia:configure.zcml')
+ return config.make_wsgi_app()
+
View
5 repoze/virginia/configure.zcml → virginia/configure.zcml
@@ -1,8 +1,7 @@
<configure
- xmlns="http://namespaces.repoze.org/bfg"
- i18n_domain="repoze.bfg">
+ xmlns="http://pylonshq.com/pyramid">
- <include package="repoze.bfg.includes" />
+ <include package="pyramid.includes" />
<!-- default views: publisher will call these -->
View
0 repoze/virginia/interfaces.py → virginia/interfaces.py
File renamed without changes.
View
6 repoze/virginia/models.py → virginia/models.py
@@ -2,9 +2,9 @@
from zope.interface import implements
-from repoze.virginia.interfaces import IFile
-from repoze.virginia.interfaces import IDirectory
-from repoze.virginia.interfaces import IFilesystem
+from virginia.interfaces import IFile
+from virginia.interfaces import IDirectory
+from virginia.interfaces import IFilesystem
class Filesystem(object):
implements(IFilesystem)
View
0 repoze/virginia/tests/__init__.py → virginia/tests/__init__.py
File renamed without changes.
View
12 repoze/virginia/tests/test_models.py → virginia/tests/test_models.py
@@ -2,7 +2,7 @@
class FilesystemTests(unittest.TestCase):
def _getTargetClass(self):
- from repoze.virginia.models import Filesystem
+ from virginia.models import Filesystem
return Filesystem
def _makeOne(self, *arg, **kw):
@@ -39,7 +39,7 @@ def test_read(self):
class DirectoryTests(unittest.TestCase):
def _getTargetClass(self):
- from repoze.virginia.models import Directory
+ from virginia.models import Directory
return Directory
def _makeOne(self, *arg, **kw):
@@ -52,7 +52,7 @@ def test_getitem_islink_tofile_samedir(self):
fs = DummyFilesystem(links, files)
directory = self._makeOne(fs, '/foo')
result = directory['bar']
- from repoze.virginia.models import File
+ from virginia.models import File
self.failUnless(isinstance(result, File))
self.assertEqual(result.path, '/foo/baz')
@@ -66,21 +66,21 @@ def test_getitem_isdir(self):
fs = DummyFilesystem(dirs=['/foo/dir'])
directory = self._makeOne(fs, '/foo')
result = directory['dir']
- from repoze.virginia.models import Directory
+ from virginia.models import Directory
self.failUnless(isinstance(result, Directory))
self.assertEqual(result.path, '/foo/dir')
def test_getitem_isfile(self):
fs = DummyFilesystem(files=['/foo/file'])
directory = self._makeOne(fs, '/foo')
result = directory['file']
- from repoze.virginia.models import File
+ from virginia.models import File
self.failUnless(isinstance(result, File))
self.assertEqual(result.path, '/foo/file')
class FileTests(unittest.TestCase):
def _getTargetClass(self):
- from repoze.virginia.models import File
+ from virginia.models import File
return File
def _makeOne(self, *arg, **kw):
View
10 repoze/virginia/tests/test_views.py → virginia/tests/test_views.py
@@ -1,5 +1,5 @@
import unittest
-from repoze.bfg import testing
+from pyramid import testing
class FileViewTests(unittest.TestCase):
def setUp(self):
@@ -9,7 +9,7 @@ def tearDown(self):
testing.tearDown()
def _getFUT(self):
- from repoze.virginia.views import file_view
+ from virginia.views import file_view
return file_view
def _registerView(self, app, name):
@@ -32,7 +32,7 @@ def tearDown(self):
testing.tearDown()
def _getFUT(self):
- from repoze.virginia.views import directory_view
+ from virginia.views import directory_view
return directory_view
def _getEnviron(self, **kw):
@@ -84,7 +84,7 @@ def test___call___redirects_to_slash(self):
class StructuredTextViewTests(unittest.TestCase):
def _getFUT(self):
- from repoze.virginia.views import structured_text_view
+ from virginia.views import structured_text_view
return structured_text_view
def test___call__(self):
@@ -104,7 +104,7 @@ def test___call__(self):
class RawViewTests(unittest.TestCase):
def _getFUT(self):
- from repoze.virginia.views import raw_view
+ from virginia.views import raw_view
return raw_view
def test___call__(self):
View
2 repoze/virginia/views.py → virginia/views.py
@@ -9,7 +9,7 @@
from webob import Response
from webob.exc import HTTPFound
-from repoze.bfg.view import render_view_to_response
+from pyramid.view import render_view_to_response
def file_view(context, request):
dirname, filename = os.path.split(context.path)

0 comments on commit 736e8cc

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