Commits

offline committed f5f6ad1

get_config function added

Comments (0)

Files changed (2)

annoying/functions.py

 from django.shortcuts import _get_queryset
+from django.conf import settings
 
 
 def get_object_or_None(klass, *args, **kwargs):
     except queryset.model.DoesNotExist:
         return None
 
+
+
+def get_config(key, default):
+    """
+    Get settings from django.conf if exists,
+    return default value otherwise
+
+    example:
+
+    ADMIN_EMAIL = get_config('ADMIN_EMAIL', 'default@email.com')
+    """
+    return getattr(settings, key, default)
 from setuptools import setup, find_packages
 setup(
     name = "django-annoying",
-    version = "0.5.1",
+    version = "0.6.0",
     packages = find_packages(),
     author = "Anderson",
     author_email = "self.anderson@gmail.com",
             - signals decorator - allow use signals as decorators.
             - ajax_request decorator - returns JsonResponse with this dict as content.
             - get_object_or_None function - similar to get_object_or_404, but returns None if object not found.
+            - get_config function - get settings from django.conf if exists, return default value otherwise.
             - AutoOneToOne field - creates related object on first call if it doesnt exists yet.
             - HttpResponseReload - reload and stay on same page from where request was made.
 
 
         **Download:**
 
-            - hg clone http://hg.assembla.com/django-annoying
+            - hg clone https://offline@bitbucket.org/offline/django-annoying/
 
     """,
     license = "BSD",
     keywords = "django",
-    url = "http://www.assembla.com/spaces/django-annoying",
+    url = "http://bitbucket.org/offline/django-annoying/wiki/Home",
 )