Fixes to {Site,Home}Settings
Also improved help text on HomeSettings partial_path and link_name.
--- a/app/soc/logic/site/map.py Sat Nov 08 18:35:46 2008 +0000
+++ b/app/soc/logic/site/map.py Sun Nov 09 21:24:49 2008 +0000
@@ -185,7 +185,14 @@
page.Url(
r'^site/show/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
'soc.views.models.site_settings.public'),
- 'Show Document',
+ 'Show Site Settings',
+ parent=home)
+
+site_settings_delete = page.Page(
+ page.Url(
+ r'^site/delete/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ 'soc.views.models.site_settings.delete'),
+ 'Delete Site Settings',
parent=home)
--- a/app/soc/models/home_settings.py Sat Nov 08 18:35:46 2008 +0000
+++ b/app/soc/models/home_settings.py Sun Nov 09 21:24:49 2008 +0000
@@ -52,20 +52,13 @@
'The URL should be a valid ATOM or RSS feed. '
'Feed entries are shown on the home page.')
-#: Required path, prepended to a "link name" to form the document URL.
- #: The combined path and link name must be globally unique on the
- #: site. Except in /site/docs (Developer) forms, this field is not
- #: usually directly editable by the User, but is instead set by controller
- #: logic to match the "scope" of the document.
+ #: Required path, prepended to a "link name" to form the Setting URL.
partial_path = db.StringProperty(required=True,
- verbose_name=ugettext_lazy('Partial path'))
+ verbose_name=ugettext_lazy('Partial path for Settings'))
partial_path.help_text = ugettext_lazy(
- 'path portion of URLs, prepended to link name')
+ 'path portion of URLs for Settings, prepended to link name')
- #: Required link name, appended to a "path" to form the document URL.
- #: The combined path and link name must be globally unique on the
- #: site (but, unlike some link names, a Work link name can be reused,
- #: as long as the combination with the preceding path is unique).
+ #: Required link name, appended to a "path" to form the Setting URL.
link_name = db.StringProperty(required=True,
- verbose_name=ugettext_lazy('Link name'))
- link_name.help_text = ugettext_lazy('link name used in URLs')
+ verbose_name=ugettext_lazy('Link name for Settings'))
+ link_name.help_text = ugettext_lazy('link name for Settings used in URLs')
--- a/app/soc/views/models/home_settings.py Sat Nov 08 18:35:46 2008 +0000
+++ b/app/soc/views/models/home_settings.py Sun Nov 09 21:24:49 2008 +0000
@@ -30,6 +30,7 @@
from soc.logic import dicts
from soc.logic import validate
+from soc.logic.models import document as document_logic
from soc.views import helper
from soc.views.helper import widgets
from soc.views.models import base
@@ -129,8 +130,8 @@
'list_heading': 'soc/home_settings/list/home_heading.html',
}
- params['delete_redirect'] = 'home/list'
- params['create_redirect'] = 'home/edit'
+ params['delete_redirect'] = '/home/list'
+ params['create_redirect'] = '/home/edit'
params['save_message'] = [ugettext_lazy('Profile saved.')]
@@ -169,11 +170,25 @@
"""
try:
- form.fields['doc_partial_path'].initial = entity.home.partial_path
- form.fields['doc_link_name'].initial = entity.home.link_name
+ if entity.home:
+ form.fields['doc_partial_path'].initial = entity.home.partial_path
+ form.fields['doc_link_name'].initial = entity.home.link_name
except db.Error:
pass
+ def _editPost(self, request, entity, fields):
+ """See base.View._editPost().
+ """
+
+ doc_partial_path = fields['doc_partial_path']
+ doc_link_name = fields['doc_link_name']
+
+ # TODO notify the user if home_doc is not found
+ home_doc = document_logic.logic.getFromFields(
+ partial_path=doc_partial_path, link_name=doc_link_name)
+
+ fields['home'] = home_doc
+
view = View()
--- a/app/soc/views/models/site_settings.py Sat Nov 08 18:35:46 2008 +0000
+++ b/app/soc/views/models/site_settings.py Sun Nov 09 21:24:49 2008 +0000
@@ -92,8 +92,8 @@
'list_heading': 'soc/site_settings/list/site_heading.html',
}
- params['delete_redirect'] = 'site/list'
- params['create_redirect'] = 'site/edit'
+ params['delete_redirect'] = '/site/list'
+ params['create_redirect'] = '/site/edit'
params = dicts.merge(original_params, params)
rights = dicts.merge(original_rights, rights)