# HG changeset patch # User Pawel Solyga # Date 1223936536 0 # Node ID 4e336befdf866174369952c60ce3396fd4c034d4 # Parent e8eeccd7ef0f8592ad71de1728aea5022e0e7691 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 diff -r e8eeccd7ef0f -r 4e336befdf86 app/soc/logic/models/settings.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" ', - ] - - -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() diff -r e8eeccd7ef0f -r 4e336befdf86 app/soc/logic/models/site_settings.py --- /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" ', + ] + + +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() diff -r e8eeccd7ef0f -r 4e336befdf86 app/soc/views/site/home.py --- 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: