Rename soc/logic/models/settings.py to model site_settings.py and apply import name change to soc/views/site/home.py
authorPawel Solyga <Pawel.Solyga@gmail.com>
Mon, 13 Oct 2008 22:22:16 +0000
changeset 319 4e336befdf86
parent 318 e8eeccd7ef0f
child 320 a0a86306e7f6
Rename soc/logic/models/settings.py to model site_settings.py and apply import name change to soc/views/site/home.py Patch by: Pawel Solyga Review by: to-be-reviewed
app/soc/logic/models/settings.py
app/soc/logic/models/site_settings.py
app/soc/views/site/home.py
--- a/app/soc/logic/models/settings.py	Mon Oct 13 22:18:54 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#!/usr/bin/python2.5
-#
-# Copyright 2008 the Melange authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""SiteSettings (Model) query functions.
-"""
-
-__authors__ = [
-  '"Sverre Rabbelier" <sverer@rabbelier.nl>',
-  ]
-
-
-from soc.logic import key_name
-from soc.logic.models import base
-
-import soc.models.site_settings
-
-
-class Logic(base.Logic):
-  """Logic methods for the SiteSettings model
-  """
-
-  def __init__(self):
-    """Defines the name, key_name and model for this entity.
-    """
-
-    self._name = "site_settings"
-    self._model = soc.models.site_settings.SiteSettings
-    self._keyName = key_name.nameSiteSettings
-    self._skip_properties = []
-
-
-logic = Logic()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/logic/models/site_settings.py	Mon Oct 13 22:22:16 2008 +0000
@@ -0,0 +1,45 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2008 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""SiteSettings (Model) query functions.
+"""
+
+__authors__ = [
+  '"Sverre Rabbelier" <sverer@rabbelier.nl>',
+  ]
+
+
+from soc.logic import key_name
+from soc.logic.models import base
+
+import soc.models.site_settings
+
+
+class Logic(base.Logic):
+  """Logic methods for the SiteSettings model
+  """
+
+  def __init__(self):
+    """Defines the name, key_name and model for this entity.
+    """
+
+    self._name = "site_settings"
+    self._model = soc.models.site_settings.SiteSettings
+    self._keyName = key_name.nameSiteSettings
+    self._skip_properties = []
+
+
+logic = Logic()
--- a/app/soc/views/site/home.py	Mon Oct 13 22:18:54 2008 +0000
+++ b/app/soc/views/site/home.py	Mon Oct 13 22:22:16 2008 +0000
@@ -43,7 +43,7 @@
 from soc.views import helper
 from soc.views.helper import access
 
-import soc.logic.models.settings
+import soc.logic.models.site_settings
 import soc.models.document
 import soc.models.site_settings
 import soc.views.helper.forms
@@ -110,7 +110,8 @@
   # create default template context for use with any templates
   context = helper.responses.getUniversalContext(request)
   
-  site_settings = soc.logic.models.settings.logic.getFromFields(path=DEF_SITE_SETTINGS_PATH)
+  site_settings = soc.logic.models.site_settings.logic.getFromFields(
+                                                  path=DEF_SITE_SETTINGS_PATH)
 
   if site_settings:
     context['site_settings'] = site_settings
@@ -178,13 +179,13 @@
       
       feed_url = settings_form.cleaned_data.get('feed_url')
 
-      site_settings = models.settings.logic.updateOrCreateFromFields(
+      site_settings = models.site_settings.logic.updateOrCreateFromFields(
           {'feed_url': feed_url, 'home': site_doc}, path=DEF_SITE_SETTINGS_PATH)
       
       context['notice'] = 'Site Settings saved.'
   else: # request.method == 'GET'
     # try to fetch SiteSettings entity by unique key_name
-    site_settings = models.settings.logic.getFromFields(
+    site_settings = models.site_settings.logic.getFromFields(
         path=DEF_SITE_SETTINGS_PATH)
 
     if site_settings: