88
99class Resource (object ):
1010 '''
11- Resoruce class implements all the logic of mapping HTTP methods to
11+ Resource class implements all the logic of mapping HTTP methods to
1212 methods and error handling
1313 '''
1414
@@ -26,7 +26,7 @@ def __init__(self, request, formatter):
2626 sublcass -- request wrapper object
2727
2828 :param formatter: :class: `restea.formats.BaseFormatter` subclass --
29- formatter class implmementing serialization and unserialization of
29+ formatter class implementing serialization and unserialization of
3030 the data
3131 '''
3232 if not hasattr (self , 'fields' ):
@@ -40,15 +40,15 @@ def _iden_required(self, method_name):
4040 Checks if given method requires iden
4141
4242 :param method_name: string -- name of method on a resrouce
43- :returns: bool - boolean value of whatever iden needed or not
43+ :returns: bool - boolean value of whatever iden is needed or not
4444 '''
4545 return method_name not in ('list' , 'create' )
4646
4747 def _apply_decorators (self , method ):
4848 '''
4949 Returns method decorated with decorators specified in self.decorators
5050 :param method: -- resource method
51- :returns: method derocated
51+ :returns: decorated method
5252 '''
5353 if not hasattr (self , 'decorators' ):
5454 return method
@@ -65,7 +65,7 @@ def _get_method_name(self, has_iden):
6565 :param has_iden: specifies if requested url has iden (i.e /res/ vs
6666 /res/1)
6767 :raises errors.MethodNotAllowedError: if HTTP method is not supprted
68- :returns: string - name of the resorce method name
68+ :returns: string - name of the resource method name
6969 '''
7070 method = self .request .method
7171 method = self .request .headers .get (
@@ -97,7 +97,7 @@ def _get_method_name(self, has_iden):
9797 @property
9898 def _is_valid_formatter (self ):
9999 '''
100- Returns is self.fomatter refers to a valid formatter class object
100+ Returns is self.formatter refers to a valid formatter class object
101101 :returns: bool
102102 '''
103103 return (
@@ -125,7 +125,7 @@ def _get_method(self, method_name):
125125 :param method_name: string -- name of the method
126126 :raises errors.BadRequestError: method is not implemented for a given
127127 resource
128- :returns: -- method of the rest resource object
128+ :returns: -- method of the REST resource object
129129 '''
130130 method_exists = hasattr (self , method_name )
131131 if not method_exists :
@@ -140,7 +140,7 @@ def _get_payload(self):
140140 Returns a validated and parsed payload data for request
141141
142142 :raises restea.errors.BadRequestError: unparseable data
143- :raises restea.errors.BadRequestError: payload is not mapable
143+ :raises restea.errors.BadRequestError: payload is not mappable
144144 :raises restea.errors.BadRequestError: validation of fields not passed
145145 :returns: dict - validated data passed to resource
146146 '''
@@ -173,7 +173,7 @@ def process(self, *args, **kwargs):
173173
174174 :raises restea.errors.BadRequestError: wrong self.formatter type
175175 :raises restea.errors.ServerError: Some unhandled exception in
176- resrouce method implementation or formatter serialization error
176+ resource method implementation or formatter serialization error
177177
178178 :returns: string -- serialized data to be returned to client
179179 '''
@@ -198,14 +198,15 @@ def process(self, *args, **kwargs):
198198 try :
199199 return self .formatter .serialize (res )
200200 except formats .LoadError :
201- raise errors .ServerError ('Service can\' t respond in this format' )
201+ raise errors .ServerError ('Service can\' t respond with this format' )
202202
203203 def dispatch (self , * args , ** kwargs ):
204204 '''
205205 Dispatches the request and handles exception to return data, status
206206 and content type
207207
208- :retruns: tuple -- 3 element tuple: result, http code and content type
208+ :returns: tuple -- 3 element tuple: result, HTTP status code and
209+ content type
209210 '''
210211 try :
211212 return (
0 commit comments