Permalink
Browse files

Removed cornice for now as it throws syntax errors on Python 3.x

  • Loading branch information...
1 parent 653baec commit 8422c1ab075494f492e0a5dffc8b00912af65dda Jukka Ojaniemi committed Mar 20, 2013
Showing with 0 additions and 93 deletions.
  1. +0 −3 setup.py
  2. +0 −1 whiskers/__init__.py
  3. +0 −89 whiskers/views/api.py
View
@@ -7,7 +7,6 @@
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
- 'cornice',
'pyramid',
'pyramid_tm',
'pyramid_debugtoolbar',
@@ -41,8 +40,6 @@
zip_safe=False,
test_suite='whiskers.tests',
install_requires=requires,
- extras_require=[
- {'docs': 'Sphinx'}],
entry_points="""\
[paste.app_factory]
main = whiskers:main
View
@@ -59,5 +59,4 @@ def main(global_config, **settings):
config.add_view(HostsView, route_name='host', attr="host_view",
renderer='views/templates/host.pt')
- config.scan("whiskers.views.api")
return config.make_wsgi_app()
View
@@ -1,89 +0,0 @@
-from cornice import Service
-from whiskers.models import (
- Package,
- Buildout,
- Host,
- Version,
- DBSession)
-
-
-package_info = Service(name='package_info',
- path='/api/package/{package}/{version}',
- description="Package info.")
-
-
-@package_info.get()
-def get_package_info(request):
- """Returns the information about package."""
- package = request.matchdict['package']
- version = request.matchdict['version']
-
- result = DBSession.query(Package).\
- join(Version, Package.version_id == Version.id).\
- filter(Package.name == package,
- Version.version == version).first()
-
- buildouts = [buildout.name for buildout in result.buildouts]
- buildouts = tuple(set(buildouts))
-
- result_dict = {'package': result.name,
- 'version': result.version.version,
- 'buildouts': list(buildouts)}
-
- if result.required_by:
- result_dict['required_by'] = [
- {'name': package.name,
- 'version': package.version.version,
- 'id': package.id} for package in result.required_by]
-
- if result.requires:
- result_dict['requires'] = [
- {'name': package.name,
- 'version': package.version.version,
- 'id': package.id} for package in result.requires]
-
- return result_dict
-
-
-host_info = Service(name='host_info',
- path='/api/host/{host}',
- description="Host info.")
-
-
-@host_info.get()
-def get_host_info(request):
- """Return information about the host."""
- host = request.matchdict['host']
-
- result = DBSession.query(Host).\
- filter(Host.name == host).first()
- result_dict = {'host': result.name}
-
- buildouts = set([buildout.name for buildout in result.buildouts])
- result_dict['buildouts'] = list(buildouts)
- return result_dict
-
-
-buildout_info = Service(name='buildout_info',
- path='/api/buildout/{buildout}',
- description="Buildout info.")
-
-
-@buildout_info.get()
-def get_buildout_info(request):
- """Return information about the latest buildout."""
- buildout = request.matchdict['buildout']
-
- result = DBSession.query(Buildout).filter(Buildout.name == buildout).\
- order_by(Buildout.datetime).first()
- result_dict = {'name': result.name,
- 'updated': result.datetime.isoformat(),
- 'id': result.id}
-
- if result.packages:
- packages = [{'name': package.name,
- 'version': package.version.version,
- 'id': package.id} for package in result.packages]
- result_dict['packages'] = packages
-
- return result_dict

0 comments on commit 8422c1a

Please sign in to comment.