Luciano Pacheco avatar Luciano Pacheco committed 6eac07c

version bumped

Comments (0)

Files changed (2)

 
 from datetime import datetime, timedelta
 
-__version__ = '0.2.3rc1'
+__version__ = '0.2.5.8'
 
 def get_version():
     return __version__
 
     def __getattr__(self, attr):
         """
-        Returns a fresh `HttpResponse` when getting 
+        Returns a fresh `HttpResponse` when getting
         an "attribute". This is backwards compatible
         with 0.2, which is important.
         """
 
         class HttpResponseWrapper(HttpResponse):
             """
-            Wrap HttpResponse and make sure that the internal _is_string 
-            flag is updated when the _set_content method (via the content 
+            Wrap HttpResponse and make sure that the internal _is_string
+            flag is updated when the _set_content method (via the content
             property) is called
             """
             def _set_content(self, content):
                 """
-                Set the _container and _is_string properties based on the 
+                Set the _container and _is_string properties based on the
                 type of the value parameter. This logic is in the construtor
-                for HttpResponse, but doesn't get repeated when setting 
+                for HttpResponse, but doesn't get repeated when setting
                 HttpResponse.content although this bug report (feature request)
-                suggests that it should: http://code.djangoproject.com/ticket/9403 
+                suggests that it should: http://code.djangoproject.com/ticket/9403
                 """
                 if not isinstance(content, basestring) and hasattr(content, '__iter__'):
                     self._container = content
                     self._container = [content]
                     self._is_string = True
 
-            content = property(HttpResponse._get_content, _set_content)            
+            content = property(HttpResponse._get_content, _set_content)
 
         return HttpResponseWrapper(r, content_type='text/plain', status=c)
-    
+
 rc = rc_factory()
-    
+
 class FormValidationError(Exception):
     def __init__(self, form):
         self.form = form
     @decorator
     def wrap(f, self, request, *a, **kwa):
         form = v_form(getattr(request, operation))
-    
+
         if form.is_valid():
             setattr(request, 'form', form)
             return f(self, request, *a, **kwa)
     """
     Simple throttling decorator, caches
     the amount of requests made in cache.
-    
+
     If used on a view where users are required to
     log in, the username is used, otherwise the
     IP address of the originating request is used.
-    
+
     Parameters::
      - `max_requests`: The maximum number of requests
      - `timeout`: The timeout for the cache entry (default: 1 hour)
             ident = request.user.username
         else:
             ident = request.META.get('REMOTE_ADDR', None)
-    
+
         if hasattr(request, 'throttle_extra'):
             """
             Since we want to be able to throttle on a per-
             object. If so, append the identifier name with it.
             """
             ident += ':%s' % str(request.throttle_extra)
-        
+
         if ident:
             """
             Preferrably we'd use incr/decr here, since they're
             stable, you can change it here.
             """
             ident += ':%s' % extra
-    
+
             now = time.time()
             count, expiration = cache.get(ident, (1, None))
 
                 return t
 
             cache.set(ident, (count+1, expiration), (expiration - now))
-    
+
         return f(self, request, *args, **kwargs)
     return wrap
 
     In case we send data over PUT, Django won't
     actually look at the data and load it. We need
     to twist its arm here.
-    
+
     The try/except abominiation here is due to a bug
     in mod_python. This should fix it.
     """
         # Bug fix: if _load_post_and_files has already been called, for
         # example by middleware accessing request.POST, the below code to
         # pretend the request is a POST instead of a PUT will be too late
-        # to make a difference. Also calling _load_post_and_files will result 
+        # to make a difference. Also calling _load_post_and_files will result
         # in the following exception:
         #   AttributeError: You cannot set the upload handlers after the upload has been processed.
-        # The fix is to check for the presence of the _post field which is set 
-        # the first time _load_post_and_files is called (both by wsgi.py and 
+        # The fix is to check for the presence of the _post field which is set
+        # the first time _load_post_and_files is called (both by wsgi.py and
         # modpython.py). If it's set, the request has to be 'reset' to redo
         # the query value parsing in POST mode.
         if hasattr(request, '_post'):
             del request._post
             del request._files
-        
+
         try:
             request.method = "POST"
             request._load_post_and_files()
             request.META['REQUEST_METHOD'] = 'POST'
             request._load_post_and_files()
             request.META['REQUEST_METHOD'] = 'PUT'
-            
+
         request.PUT = request.POST
 
 
 
 class Mimer(object):
     TYPES = dict()
-    
+
     def __init__(self, request):
         self.request = request
-        
+
     def is_multipart(self):
         content_type = self.content_type()
 
         It will also set `request.content_type` so the handler has an easy
         way to tell what's going on. `request.content_type` will always be
         None for form-encoded and/or multipart form data (what your browser sends.)
-        """    
+        """
         ctype = self.content_type()
         self.request.content_type = ctype
-        
+
         if not self.is_multipart() and ctype:
             loadee = self.loader_for_type(ctype)
-            
+
             if loadee:
                 try:
                     self.request.data = loadee(self.request.raw_post_data)
-                        
+
                     # Reset both POST and PUT from request, as its
                     # misleading having their presence around.
                     self.request.POST = self.request.PUT = dict()
                 self.request.data = None
 
         return self.request
-                
+
     @classmethod
     def register(cls, loadee, types):
         cls.TYPES[loadee] = types
-        
+
     @classmethod
     def unregister(cls, loadee):
         return cls.TYPES.pop(loadee)
 
 def translate_mime(request):
     request = Mimer(request).translate()
-    
+
 def require_mime(*mimes):
     """
     Decorator requiring a certain mimetype. There's a nifty
     return wrap
 
 require_extended = require_mime('json', 'yaml', 'xml', 'pickle')
-    
+
 def send_consumer_mail(consumer):
     """
     Send a consumer an email depending on what their status is.
             subject += "has been canceled."
         elif consumer.status == "rejected":
             subject += "has been rejected."
-        else: 
+        else:
             subject += "is awaiting approval."
 
-    template = "piston/mails/consumer_%s.txt" % consumer.status    
-    
+    template = "piston/mails/consumer_%s.txt" % consumer.status
+
     try:
-        body = loader.render_to_string(template, 
+        body = loader.render_to_string(template,
             { 'consumer' : consumer, 'user' : consumer.user })
     except TemplateDoesNotExist:
-        """ 
+        """
         They haven't set up the templates, which means they might not want
         these emails sent.
         """
-        return 
+        return
 
     try:
         sender = settings.PISTON_FROM_EMAIL
     import ez_setup
     ez_setup.use_setuptools()
     from setuptools import setup, find_packages
-    
+
 import os
 
 setup(
     name = "django-piston",
-    version = "0.2.5.7",
+    version = "0.2.5.8",
     url = 'http://bitbucket.org/jespern/django-piston/wiki/Home',
 	download_url = 'http://bitbucket.org/jespern/django-piston/downloads/',
     license = 'BSD',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.