Skip to content

Commit

Permalink
Merge pull request #41 from mozilla-services/refactor-crud-decorator
Browse files Browse the repository at this point in the history
Update kinto to use the new crud decorator
  • Loading branch information
Natim committed Jun 5, 2015
2 parents 0c9484e + 1168944 commit 5c3f000
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 7 additions & 5 deletions kinto/views/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ class Options():
preserve_unknown = True


@resource.crud(path="/collections/{collection_id}/records/{id}",
collection_path="/collections/{collection_id}/records")
@resource.register(
record_path="/collections/{{collection_id}}/records/{{id}}",
collection_path="/collections/{{collection_id}}/records",
name="collection")
class Collection(resource.BaseResource):

mapping = RecordSchema()

@property
def name(self):
return self.request.matchdict['collection_id']
def __init__(self, *args, **kwargs):
super(Collection, self).__init__(*args, **kwargs)
self.collection.collection_id = self.request.matchdict['collection_id']

def is_known_field(self, field_name):
"""Without schema, any field is considered as known."""
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
'cornice',
'six',
'waitress',
'cliquet[postgresql,monitoring] < 2.0'
'cliquet[postgresql,monitoring]' # > 2.0 once released.
]

ENTRY_POINTS = {
'paste.app_factory': [
'main = kinto:main',
]}

DEPENDENCY_LINKS = [
# Pre-release of Cliquet.
'https://github.com/mozilla-services/cliquet/tarball/#egg=Cliquet-2.0dev0',
]

setup(name='kinto',
version='1.0.0.dev0',
Expand All @@ -43,4 +47,5 @@
include_package_data=True,
zip_safe=False,
install_requires=REQUIREMENTS,
entry_points=ENTRY_POINTS)
entry_points=ENTRY_POINTS,
dependency_links=DEPENDENCY_LINKS)

0 comments on commit 5c3f000

Please sign in to comment.