Browse Source

Updated readme and settings wrapper.

Rafał Pitoń 12 years ago
parent
commit
88bbf00081
2 changed files with 72 additions and 62 deletions
  1. 10 0
      README.md
  2. 62 62
      misago/conf.py

+ 10 - 0
README.md

@@ -16,6 +16,16 @@ The secondary goal is making Misago a viable foundation for building and maintai
 Finally, while Misago is built using Django, it's not a "Django application" and it won't integrate with existing Django projects. This is the result of a design decision to use custom users/session/auth/permissions functionality instead of native Django applications - however, in the future Misago will provide a web API allowing you to add Misago-powered features to your website and/or application.
 
 
+Requirements
+------------
+
+* Shell access to your server
+* Task sheduler (eg. CronTab)
+* Python __2.7__
+* MySQL/Postgres/Oracle Database
+* Pillow Imaging Library for Python
+
+
 Dependencies
 ------------
 

+ 62 - 62
misago/conf.py

@@ -1,63 +1,63 @@
-from django.conf import settings as dj_settings
-from django.core.cache import cache
-from misago.models import Setting
-from misago.thread import local
-
-_thread_local = local()
-
-def load_settings():
-    settings = cache.get('settings', {})
-    if not settings:
-        for i in Setting.objects.all():
-            settings[i.pk] = i.value
-        cache.set('settings', settings)
-    return settings
-
-
-class MisagoSettings(object):
-    def __init__(self, local, safe):
-        self.thread = local
-        self.is_safe = safe
-
-    def settings(self):
-        try:
-            return self.thread.settings
-        except AttributeError:
-            self.thread.settings = load_settings()
-            return self.thread.settings
-
-    def setting(self, key):
-        try:
-            try:
-                return self.settings()[key]
-            except KeyError:
-                if self.is_safe:
-                    return getattr(dj_settings, key)
-                else:
-                    raise AttributeError()
-        except AttributeError:
-            raise Exception(u"Requested setting \"%s\" could not be found." % key)
-
-    def __contains__(self, key):
-        return key in self.settings()
-
-    def __getitem__(self, key):
-        return self.setting(key)
-    
-    def __getattr__(self, key):
-        return self.setting(key)
-
-    def __setitem__(self, key, value):
-        setting = Setting.objects.get(pk=key)
-        setting.value = value
-        setting.save(force_update=True)
-
-
-settings = MisagoSettings(_thread_local, True)
-
-
-def SafeSettings(): 
-    """
-    Safe settings factory for MisagoSettings
-    """
+from django.conf import settings as dj_settings
+from django.core.cache import cache
+from misago.models import Setting
+from misago.thread import local
+
+_thread_local = local()
+
+def load_settings():
+    settings = cache.get('settings', {})
+    if not settings:
+        for i in Setting.objects.all():
+            settings[i.pk] = i.value
+        cache.set('settings', settings)
+    return settings
+
+
+class MisagoSettings(object):
+    def __init__(self, local, safe):
+        self.thread = local
+        self.is_safe = safe
+
+    def settings(self):
+        try:
+            return self.thread.settings
+        except AttributeError:
+            self.thread.settings = load_settings()
+            return self.thread.settings
+
+    def setting(self, key):
+        try:
+            try:
+                return self.settings()[key]
+            except KeyError:
+                if self.is_safe:
+                    return getattr(dj_settings, key)
+                else:
+                    raise AttributeError()
+        except AttributeError:
+            raise Exception(u"Requested setting \"%s\" could not be found." % key)
+
+    def __contains__(self, key):
+        return key in self.settings()
+
+    def __getitem__(self, key):
+        return self.setting(key)
+
+    def __getattr__(self, key):
+        return self.setting(key)
+
+    def __setitem__(self, key, value):
+        setting = Setting.objects.get(pk=key)
+        setting.value = value
+        setting.save(force_update=True)
+
+
+settings = MisagoSettings(_thread_local, True)
+
+
+def SafeSettings():
+    """
+    Safe settings factory for MisagoSettings
+    """
     return MisagoSettings(_thread_local, False)