Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Freeze pymongo version to 2.3 in setup because 2.4 is not compatibl…

…e with

  last mongokit version.
* No more need to have MONGO_DB_NAME in environm it is deduced from mongo db
  uri
  • Loading branch information...
commit b9ec1bfa7b9aa4bc5bf49382b51758229b8c5ce2 1 parent 264775c
@hadrien authored
View
25 .gitignore
@@ -0,0 +1,25 @@
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.noseids
+velo/.noseids
+velo/coverage.xml
+velo/tests/.noseids
+velo/tests/coverage.xml
+coverage.xml
+nosetests.xml
View
9 .hgignore
@@ -1,9 +0,0 @@
-\.coverage
-\.noseids
-\.env
-coverage.xml
-nosetests.xml
-pyramid_rest\.egg-info
-.*\.pyc
-\.DS_Store
-docs/build
View
1  MANIFEST.in
@@ -0,0 +1 @@
+include *.rst
View
1  README.rst
@@ -72,6 +72,7 @@ Pyramid REST
What next?
----------
+#. Security
#. HTTP PATCH method: http://tools.ietf.org/html/rfc5789
#. Resource Scaffolding command;
#. Links;
View
1  example/model/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from example.model.application import Application
View
3  example/model/application.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from mongokit import Document
@@ -12,7 +11,7 @@ class Application(Document):
structure = {
'name': unicode,
- 'secret_key': basestring,
+ 'secret_key': unicode,
}
required_fields = ['name', 'secret_key']
View
1  example/model/message.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from bson.objectid import ObjectId
View
1  example/model/user.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from bson.objectid import ObjectId
View
1  example/views/application_user_messages.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from pyramid_rest.mongo import CollectionView
View
1  example/views/application_users.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from pyramid_rest.resource import method_config
View
1  example/views/applications.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from pyramid_rest.mongo import CollectionView
View
1  example/views/messages.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from pyramid_rest.mongo import CollectionView
View
10 pyramid_rest/mongo.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
import os
import logging
+from urlparse import urlparse
from bson.objectid import ObjectId, InvalidId
import mongokit
@@ -23,13 +22,12 @@
log = logging.getLogger(__name__)
-DATABASE_NAME = os.environ['MONGO_DB_NAME']
-
__all__ = ['register_document', 'CollectionView', ]
def includeme(config):
log.info('Configure mongo...')
+ os.environ['MONGO_URL_NAME'] = urlparse(os.environ['MONGO_URI']).path[1:]
connection = MongoConnection(
os.environ['MONGO_URI'],
auto_start_request=False,
@@ -79,7 +77,7 @@ def mongo_connection(request):
def mongo_db(request):
- return getattr(request.mongo_connection, DATABASE_NAME)
+ return getattr(request.mongo_connection, os.environ['MONGO_DB_NAME'])
def begin_request(event):
@@ -172,6 +170,6 @@ def show(self, **identifiers):
return self._get_document_or_404(identifiers)
def delete(self, **identifiers):
- # XXX: cascade delete sub resources?
+ """No delete cascade on sub resources."""
self._get_document_or_404(identifiers).delete()
return HTTPOk()
View
1  pyramid_rest/renderer.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
from datetime import datetime, date
from decimal import Decimal
import json
View
3  pyramid_rest/resource.py
@@ -120,7 +120,8 @@ def add_resource(
try:
cls = config.maybe_dotted(dotted_class)
except ImportError:
- raise ImportError('No class %s found.' % dotted_class)
+ log.error('No class %s found.', dotted_class)
+ raise
config.scan(dotted_module)
res(cls) # decorate class to register config
View
1  pyramid_rest/tests/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
import os
View
6 pyramid_rest/tests/functional/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
+import os
import sys
import unittest
@@ -18,10 +18,10 @@ def setUp(self):
@property
def mongo_db(self):
- from pyramid_rest.mongo import IMongoConnection, DATABASE_NAME
+ from pyramid_rest.mongo import IMongoConnection
return getattr(
self.app.app.registry.getUtility(IMongoConnection),
- DATABASE_NAME
+ os.environ['MONGO_DB_NAME']
)
def tearDown(self):
View
1  pyramid_rest/tests/functional/test_resource.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
import unittest
from pyramid import testing
View
1  pyramid_rest/tests/unittests/test_mongo.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
import unittest
View
1  pyramid_rest/tests/unittests/test_renderer.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
import unittest
from decimal import Decimal
from bson.objectid import ObjectId
View
2  setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = pyramid_rest
-version = 0.1.0
+version = 0.2.1
summary = Pyramid Rest Extension
requires-dist =
pyramid
View
3  setup.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-from __future__ import absolute_import
import setuptools
if not getattr(setuptools, "_distribute", False):
@@ -20,7 +19,7 @@
'yanc',
]
-extras_require = {'mongo': ['mongokit', ]}
+extras_require = {'mongo': ['mongokit', 'pymongo==2.3']}
setuptools.setup(
setup_requires=setup_requires,
Please sign in to comment.
Something went wrong with that request. Please try again.