Anyjson, docstrings

This commit is contained in:
Kenneth Reitz
2011-02-21 14:21:56 -05:00
parent d24543ea8f
commit a420529574
3 changed files with 35 additions and 6 deletions
+16 -4
View File
@@ -1,8 +1,20 @@
import json
# -*- coding: utf-8 -*-
"""
convore.groups
~~~~~~~~~~~
This module implements the group endpoint sub-wrappers.
:copyright: (c) 2011 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
import api
import models
from types import SyncedList
from convore.packages.anyjson import deserialize
from convore.types import SyncedList
class GroupsDiscover(object):
@@ -15,7 +27,7 @@ class GroupsDiscover(object):
def _discover_group(self, *cats):
_groups = []
r = api.get('groups', 'discover', *cats)
for group in json.loads(r.content)['groups']:
for group in deserialize(r.content)['groups']:
_group = models.Group()
_group.import_from_api(group)
_groups.append(_group)
@@ -37,7 +49,7 @@ class GroupsDiscoverExplore(object):
def _discover_group(self, *cats):
_groups = []
r = api.get('groups', 'discover', *cats)
for group in json.loads(r.content)['groups']:
for group in deserialize(r.content)['groups']:
_group = models.Group()
_group.import_from_api(group)
_groups.append(_group)
+14
View File
@@ -1,5 +1,19 @@
# -*- coding: utf-8 -*-
"""
convore.models
~~~~~~~~~~~~~~
This module implements the internal models for
Convore API object storage.
:copyright: (c) 2011 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
from datetime import datetime
class User(object):
"""Convore User object."""
+5 -2
View File
@@ -3,14 +3,17 @@
convore.types
~~~~~~~~~~~
This module contains he wrapper objects.
This module contains the reusable helper objects
used throughout the wrapper.
:copyright: (c) 2011 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
class SyncedList(object):
""" Synced List datatype.
"""Synced List datatype.
__data_keys__ are the list of 'primary keys' for item lookup.
self.get() needs to be defined.