Commits

Florian Schlachter  committed 78543ac

Minor fixes

  • Participants
  • Parent commits ebd713a

Comments (0)

Files changed (8)

File example_project/server/django_server/ajax_client/templates/ajax_client/index.html

                 var way = $("input[name=way1]:checked").val();
                 var data = {_call: method, _access_key: key, a: a, b: b};
                 
-                var callback_fn = function(result) {
-                    if(result.success)
+                var callback_fn = function (result) {
+                    if (result.success)
                         $("#example1 #result").html("Result of calculation is: " + result.result);
                     else
                         alert(result.errors);
-                }
+                };
                 
                 if (way == 'ajax')
                     $.get("/api/calculator/one/", data, callback_fn);
                     'b': b
                 })};
                 
-                var callback_fn = function(result) {
-                    if(result.success)
+                var callback_fn = function (result) {
+                    if (result.success)
                         $("#example2 #result").html("Result of calculation is: " + result.result);
                     else
                         alert(result.errors);
-                }
+                };
                 
                 if (way == 'ajax')
                     $.get("/api/calculator/one/", data, callback_fn);

File example_project/server/django_server/api/handlers.py

     fun = True
     
     def get_access_keys(self):
-        return (self.__authentication__, self.session.access_key)
+        return self.__authentication__, self.session.access_key
     get_access_keys.published = True
     
     def multiply(self, a, b):

File simpleapi/client/client.py

 
             try:
                 response = formatter.parse(response_buffer)
-            except (cPickle.UnpicklingError, EOFError), e:
+            except (cPickle.UnpicklingError, EOFError), _:
                 raise ClientException(
                     u'Couldn\'t unpickle response ' \
                     'data. Did you added "pickle" to the namespace\'s' \

File simpleapi/message/py2xml.py

 # -*- coding: utf-8 -*-
 
 from xml.etree import cElementTree as ET
-import base64
 from dateutil.parser import parse
 
 __all__ = ('PythonToXML',)

File simpleapi/server/feature.py

 
 import cPickle
 import hashlib
-import warnings
 
-from simpleapi.message import formatters, Formatter
 from simpleapi.message.common import SAException
 
 try:
     from django.core.cache import cache
+
     has_django = True
 except:
     has_django = False
 
 __all__ = ('__features__', 'Feature', 'FeatureException', 'FeatureContentResponse')
 
+
 class FeatureException(SAException): pass
+
+
 class FeatureContentResponse(FeatureException): pass
-class Feature(object):
 
+
+class Feature(object):
     def __init__(self, ns_config):
         self.ns_config = ns_config
         self.setup()
         if self.is_triggered(response):
             self.handle_response(response)
 
-    def setup(self): pass
-    def handle_request(self, request): pass
-    def handle_response(self, response): pass
+    def setup(self):
+        pass
+
+    def handle_request(self, request):
+        pass
+
+    def handle_response(self, response):
+        pass
 
-class CachingFeature(Feature):
 
+class CachingFeature(Feature):
     __config__ = ('caching', (dict, bool))
 
     def setup(self):
             arg_signature = hashlib.md5(cPickle.dumps(
                 request.session.arguments)).hexdigest()
 
-            timeout = 60*60
+            timeout = 60 * 60
             prefix = None
 
             if isinstance(caching_config, dict):
                 response.session.cache_timeout
             )
 
-class ThrottlingFeature(Feature):
 
+class ThrottlingFeature(Feature):
     __config__ = ('throttling', dict)
 
     def setup(self):
                 try:
                     cache.incr(rph_key)
                 except ValueError:
-                    cache.set(rph_key, 1, 60*60)
+                    cache.set(rph_key, 1, 60 * 60)
+
 
 __features__ = {
     'caching': CachingFeature,

File simpleapi/server/request.py

 # -*- coding: utf-8 -*-
 
-import warnings
 import tempfile
 import pprint
 try:
                                         '\'value\'.')
             try:
                 request_items = self.input_formatter.kwargs(data, 'parse')
-            except ValueError, e:
+            except ValueError, _:
                 raise RequestException(u'Data couldn\'t be decoded. ' \
                                         'Please check _input and your _data')
             else:
             for key, value in request_items.iteritems():
                 try:
                     new_request_items[str(key)] = self.input_formatter.kwargs(value, 'parse')
-                except ValueError, e:
+                except ValueError, _:
                     raise
                     raise RequestException(u'Value for %s couldn\'t be decoded.' % \
                         key)

File simpleapi/server/serializer.py

 # -*- coding: utf-8 -*-
 
-import re
-
 try:
     from django.db.models import Model
     from django.db.models.query import QuerySet

File tests/settings.py

+SECRET_KEY = "foo"