Skip to content

Commit

Permalink
Rename restpy to restea since there's alread registered restpy package
Browse files Browse the repository at this point in the history
  • Loading branch information
bodbdigr committed Mar 26, 2015
1 parent 54b7863 commit 343d379
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
test:
flake8 .
nosetests --with-coverage --cover-package=restpy ./tests/
nosetests --with-coverage --cover-package=restea ./tests/
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
**************************************
Rest.py: Simple RESTful server toolkit
ResTea: Simple RESTful server toolkit
**************************************

Resy.py is a RESTful server toolkit aimed to be simple, fast and framework
Restea is a RESTful server toolkit aimed to be simple, fast and framework
agnostic. It abstracts out the mapping between HTTP methods and functions,
data passing between client and server and validation. It doesn't bound to
any ORM or DB etc.

.. image:: https://api.travis-ci.org/bodbdigr/rest.py.svg
.. image:: https://api.travis-ci.org/bodbdigr/restea.svg
8 changes: 4 additions & 4 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import random
from flask import Flask

from restpy import errors
from restpy.resource import Resource
from restpy.adapters.flaskwrap import FlaskResourceWrapper
from restpy import fields
from restea import errors
from restea.resource import Resource
from restea.adapters.flaskwrap import FlaskResourceWrapper
from restea import fields

app = Flask(__name__)

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions restpy/adapters/base.py → restea/adapters/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import restpy.formats as formats
import restea.formats as formats


class BaseResourceWrapper(object):
Expand All @@ -7,7 +7,7 @@ class BaseResourceWrapper(object):
'''
def __init__(self, resource_class):
'''
:param resource_class: :class: `restpy.resource.Resource` -- resource
:param resource_class: :class: `restea.resource.Resource` -- resource
object implementing methods to create/edit/delete data
'''
self._resource_class = resource_class
Expand Down Expand Up @@ -41,7 +41,7 @@ def get_routes(self, path='', iden=''):

class BaseRequestWrapper(object):
'''
BaseRequestWrapper wraps the `restpy.request.Request` objects to abstract
BaseRequestWrapper wraps the `restea.request.Request` objects to abstract
implementation bettween different frameworks
'''
def __init__(self, original_request):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import restpy.formats as formats
import resttea.formats as formats
from django.http import HttpResponse
from django.conf.urls import patterns, url

from restpy.adapters.base import (
from restea.adapters.base import (
BaseResourceWrapper,
BaseRequestWrapper,
)
Expand Down Expand Up @@ -57,7 +57,7 @@ class DjangoResourceRouter(BaseResourceWrapper):

def wrap_request(self, request, *args, **kwargs):
'''
Prepares data and pass control to `restpy.Resource` object
Prepares data and pass control to `restea.Resource` object
:returns: :class: `django.http.HttpResponse`
'''
Expand Down
8 changes: 4 additions & 4 deletions restpy/adapters/flaskwrap.py → restea/adapters/flaskwrap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import flask
import restpy.formats as formats
import restea.formats as formats

from restpy.adapters.base import (
from restea.adapters.base import (
BaseResourceWrapper,
BaseRequestWrapper,
)
Expand Down Expand Up @@ -51,7 +51,7 @@ def get(self, value):
class FlaskResourceWrapper(BaseResourceWrapper):
'''
FlaskResourceWrapper implements flask 'view' api for the
`restpy.Resource` object, aka routing and return values in flask format
`restea.Resource` object, aka routing and return values in flask format
'''
@property
def app(self):
Expand All @@ -63,7 +63,7 @@ def app(self):

def wrap_request(self, *args, **kwargs):
'''
Prepares data and pass control to `restpy.Resource` object
Prepares data and pass control to `restea.Resource` object
:returns: :class: `flask.Response`
'''
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions restpy/fields.py → restea/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class FieldSet(object):
'''
FieldSet is a container for :class: `restpy.fields.Field`. It registers
FieldSet is a container for :class: `restea.fields.Field`. It registers
fields and also abstracts out validation.
'''

Expand All @@ -16,7 +16,7 @@ class ConfigurationError(Exception):
def __init__(self, **fields):
'''
:param **fields: dict -- mapping of field names to
:class: `restpy.fields.Field`
:class: `restea.fields.Field`
'''
self.fields = {}
for name, field in fields.iteritems():
Expand Down Expand Up @@ -46,9 +46,9 @@ def validate(self, data):
'''
Validates payload input
:param data: dict -- input playload data to be validated
:raises restpy.fields.FieldSet.Error: field validation faield
:raises restpy.fields.FieldSet.Error: required field missing
:raises restpy.fields.FieldSet.ConfigurationError: misformed field
:raises restea.fields.FieldSet.Error: field validation faield
:raises restea.fields.FieldSet.Error: required field missing
:raises restea.fields.FieldSet.ConfigurationError: misformed field
:returns: dict -- validated data
'''
field_names = self.field_names
Expand Down Expand Up @@ -96,7 +96,7 @@ def _get_setting_validator(self, setting_name):
'''
Get a validation for a setting name provided
:param setting_name: string -- name of the setting
:raises restpy.fields.FieldSet.ConfigurationError: validator method
:raises restea.fields.FieldSet.ConfigurationError: validator method
is not found for a current class
:returns: function -- field method handling setting validation
'''
Expand Down
4 changes: 2 additions & 2 deletions restpy/formats.py → restea/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LoadError(Exception):

class FormatterRegistry(type):
'''
Registry metaclass. Registers all `restpy.formats.BaseFormat` sublcasses
Registry metaclass. Registers all `restea.formats.BaseFormat` sublcasses
in _formatter_registry
'''
def __init__(cls, name, bases, dict):
Expand Down Expand Up @@ -84,7 +84,7 @@ def get_formatter(format_name):
'''
Factory method returning format class based on it's name
:param format_name: string -- name of the format
:returns: either subclass :class: `restpy.formats.BaseFormatter` or None
:returns: either subclass :class: `restea.formats.BaseFormatter` or None
'''
return _formatter_registry.get(format_name)

Expand Down
24 changes: 12 additions & 12 deletions restpy/resource.py → restea/resource.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import collections
import restpy.errors as errors
import restpy.formats as formats
import restpy.fields as fields
import restea.errors as errors
import restea.formats as formats
import restea.fields as fields


# TODO: Add fileds with validation
Expand All @@ -22,10 +22,10 @@ class Resource(object):

def __init__(self, request, formatter):
'''
:param request: :class: `restpy.apapters.base.BaseRequestWrapper`
:param request: :class: `restea.apapters.base.BaseRequestWrapper`
sublcass -- request wrapper object
:param formatter: :class: `restpy.formats.BaseFormatter` subclass --
:param formatter: :class: `restea.formats.BaseFormatter` subclass --
formatter class implmementing serialization and unserialization of
the data
'''
Expand Down Expand Up @@ -109,9 +109,9 @@ def _is_valid_formatter(self):
def _error_formatter(self):
'''
Formatter used in case of error, uses self.formatter with fallback to
`restpy.formats.DEFAULT_FORMATTER`
`restea.formats.DEFAULT_FORMATTER`
:returns: :class: subclass of `restpy.formats.BaseFormatter`
:returns: :class: subclass of `restea.formats.BaseFormatter`
'''
if self._is_valid_formatter:
return self.formatter
Expand Down Expand Up @@ -139,9 +139,9 @@ def _get_payload(self):
'''
Returns a validated and parsed payload data for request
:raises restpy.errors.BadRequestError: unparseable data
:raises restpy.errors.BadRequestError: payload is not mapable
:raises restpy.errors.BadRequestError: validation of fields not passed
:raises restea.errors.BadRequestError: unparseable data
:raises restea.errors.BadRequestError: payload is not mapable
:raises restea.errors.BadRequestError: validation of fields not passed
:returns: dict - validated data passed to resource
'''
if not self.request.data:
Expand Down Expand Up @@ -171,8 +171,8 @@ def process(self, *args, **kwargs):
Processes the payload and maps HTTP method to resource object methods
and calls the method
:raises restpy.errors.BadRequestError: wrong self.formatter type
:raises restpy.errors.ServerError: Some unhandled exception in
:raises restea.errors.BadRequestError: wrong self.formatter type
:raises restea.errors.ServerError: Some unhandled exception in
resrouce method implementation or formatter serialization error
:returns: string -- serialized data to be returned to client
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@


setup(
name='restpy',
packages=['restpy'],
name='restea',
packages=['restea'],
version='0.1.0',
description='Simple RESTful server toolkit',
author='Walery Jadłowski',
author_email='bodb.digr@gmail.com',
url='https://github.com/bodbdigr/rest.py',
download_url='https://github.com/bodbdigr/rest.py/archive/v0.1.0.tar.gz',
keywords=['rest', 'restful', 'rest.py'],
keywords=['rest', 'restful', 'restea'],
classifiers=[]
)
2 changes: 1 addition & 1 deletion tests/test_fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mock
import nose
from restpy.fields import (
from restea.fields import (
Field,
FieldSet,
Integer,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import nose
import mock
from mock import patch
from restpy import formats
from restea import formats


@patch.object(formats, '_formatter_registry')
Expand Down
8 changes: 4 additions & 4 deletions tests/test_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from mock import patch

from restpy import errors
from restpy import formats
from restpy import fields
from restpy.resource import Resource
from restea import errors
from restea import formats
from restea import fields
from restea.resource import Resource


def create_resource_helper(
Expand Down

0 comments on commit 343d379

Please sign in to comment.