--- a/app/soc/logic/models/document.py Mon Mar 02 19:48:20 2009 +0000
+++ b/app/soc/logic/models/document.py Mon Mar 02 20:32:59 2009 +0000
@@ -61,6 +61,12 @@
return ['prefix', 'scope_path', 'link_id']
+ def isDeletable(self, entity):
+ """See base.Logic.isDeletable.
+ """
+
+ return not entity.home
+
def _updateField(self, entity, entity_properties, name):
"""Special logic for role. If state changes to active we flush the sidebar.
"""
--- a/app/soc/views/helper/params.py Mon Mar 02 19:48:20 2009 +0000
+++ b/app/soc/views/helper/params.py Mon Mar 02 20:32:59 2009 +0000
@@ -45,6 +45,7 @@
DEF_SUBMIT_MSG_PARAM_NAME = 's'
DEF_SUBMIT_MSG_PROFILE_SAVED = 0
+DEF_SUBMIT_MSG_CANNOT_DELETE_ENTITY = 1
# list with all js scripts used for documentary purposes
@@ -253,12 +254,17 @@
new_params['list_description'] = DEF_LIST_DESCRIPTION_FMT % params
new_params['no_lists_msg'] = ""
- new_params['save_message'] = [ugettext('%(name)s saved.' % params)]
+ new_params['save_message'] = [ugettext('%(name)s saved.' % params),
+ ugettext('Cannot delete %(name)s.' % params)]
new_params['submit_msg_param_name'] = DEF_SUBMIT_MSG_PARAM_NAME
new_params['edit_params'] = {
DEF_SUBMIT_MSG_PARAM_NAME: DEF_SUBMIT_MSG_PROFILE_SAVED,
}
+ new_params['cannot_delete_params'] = {
+ DEF_SUBMIT_MSG_PARAM_NAME: DEF_SUBMIT_MSG_CANNOT_DELETE_ENTITY,
+ }
+
new_params['dynabase'] = helper.forms.BaseForm
create_dynaproperties = {
--- a/app/soc/views/models/base.py Mon Mar 02 19:48:20 2009 +0000
+++ b/app/soc/views/models/base.py Mon Mar 02 20:32:59 2009 +0000
@@ -555,9 +555,14 @@
error, request, template=params['error_edit'])
if not self._logic.isDeletable(entity):
- # TODO: Update the notice area telling the user that they
- # can't delete the entity
- pass
+ page_params = params['cannot_delete_params']
+ params['suffix'] = entity.key().name()
+ request.path = params['edit_redirect'] % params
+
+ # redirect to the edit page
+ # display notice that entity could not be deleted
+ return helper.responses.redirectToChangedSuffix(
+ request, None, params=page_params)
self._logic.delete(entity)
redirect = params['delete_redirect']
--- a/app/soc/views/models/request.py Mon Mar 02 19:48:20 2009 +0000
+++ b/app/soc/views/models/request.py Mon Mar 02 20:32:59 2009 +0000
@@ -83,7 +83,6 @@
new_params['sidebar_defaults'] = [('/%s/list', 'List %(name_plural)s', 'list')]
new_params['create_template'] = ['soc/request/create.html']
- new_params['save_message'] = [ugettext('Request saved.')]
new_params['extra_dynaexclude'] = ['status', 'role_verbose']