Factor out direct use of the page object
Instead of directly using the page object in the html,
pass around page_name. This will make it easier to remove
Page in favor of a simpler implementation.
--- a/app/soc/logic/site/page.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/logic/site/page.py Sat Nov 15 16:17:11 2008 +0000
@@ -373,7 +373,7 @@
def makeDjangoUrl(self):
"""Returns the Django url() for the underlying self.url.
"""
- return self.url.makeDjangoUrl(page=self)
+ return self.url.makeDjangoUrl(page_name=self.short_name)
def makeDjangoUrls(self):
"""Returns an ordered mapping of unique Django url() objects.
--- a/app/soc/templates/soc/base.html Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/templates/soc/base.html Sat Nov 15 16:17:11 2008 +0000
@@ -20,10 +20,10 @@
{% endblock %}
<title>
{% block page_title %}
- {% if page %}
-{{ page.long_name }}
+ {% if page_name %}
+{{ page_name }}
{% else %}
-<Missing Page Object>
+<Missing Page Name>
{% endif %}
{% endblock %}
</title>
@@ -65,13 +65,13 @@
<div id="title">
{% block header_title %}
- {% if page %}
+ {% if page_name %}
{% comment %}
TODO(tlarsen): replace this with breadcrumbs
{% endcomment %}
- {{ page.short_name }}
+ {{ page_name }}
{% else %}
-<Missing Page Object>
+<Missing Page Name>
{% endif %}
{% endblock %}
</div>
--- a/app/soc/templates/soc/group/public.html Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/templates/soc/group/public.html Sat Nov 15 16:17:11 2008 +0000
@@ -15,7 +15,7 @@
{% load forms_helpers %}
{% block header_title %}
-{{ page.short_name }} for {{ entity.name }}
+{{ page_name }} for {{ entity.name }}
{% endblock %}
{% block body %}
--- a/app/soc/templates/soc/home/public.html Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/templates/soc/home/public.html Sat Nov 15 16:17:11 2008 +0000
@@ -35,7 +35,7 @@
{% if home_document %}
{{ home_document.title }}
{% else %}
-{{ page.long_name }}
+{{ page_name }}
{% endif %}
{% endblock %}
@@ -43,7 +43,7 @@
{% if home_document %}
{{ home_document.short_name }}
{% else %}
-{{ page.short_name }}
+{{ page_name }}
{% endif %}
{% endblock %}
--- a/app/soc/templates/soc/host/public.html Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/templates/soc/host/public.html Sat Nov 15 16:17:11 2008 +0000
@@ -15,7 +15,7 @@
{% load forms_helpers %}
{% block header_title %}
-{{ page.short_name }} for {{ entity.user.nick_name }} ({{ entity.given_name }} {{ entity.surname }})
+{{ page_name }} for {{ entity.user.nick_name }} ({{ entity.given_name }} {{ entity.surname }})
{% endblock %}
{% block body %}
--- a/app/soc/templates/soc/models/edit.html Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/templates/soc/models/edit.html Sat Nov 15 16:17:11 2008 +0000
@@ -17,7 +17,7 @@
<script type="text/javascript" src="/tiny_mce/tiny_mce_src.js"></script>
{% endblock %}
{% block header_title %}
-{{ page.short_name }}
+{{ page_name }}
{% if entity %}
<!-- TODO(srabbelier) use a generic entity name as link -->
<a href="/{{ entity_type_short|lower }}/show/{{ entity_suffix }}">"{{ entity_type }}"</a>
--- a/app/soc/templates/soc/user/edit.html Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/templates/soc/user/edit.html Sat Nov 15 16:17:11 2008 +0000
@@ -14,7 +14,7 @@
{% endcomment %}
{% load forms_helpers %}
{% block header_title %}
- {{ page.short_name }}
+ {{ page_name }}
{% if existing_user %}
for {{ existing_user.nick_name }}
<a href="mailto:{{ existing_user.account.email }} "><{{ existing_user.account.email }}></a>
--- a/app/soc/templates/soc/user/public.html Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/templates/soc/user/public.html Sat Nov 15 16:17:11 2008 +0000
@@ -15,7 +15,7 @@
{% load forms_helpers %}
{% block header_title %}
-{{ page.short_name }} for {{ entity.nick_name }}
+{{ page_name }} for {{ entity.nick_name }}
{% endblock %}
{% block body %}
--- a/app/soc/views/document/edit.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/document/edit.py Sat Nov 15 16:17:11 2008 +0000
@@ -106,7 +106,7 @@
DEF_DOCS_CREATE_TMPL = 'soc/models/edit.html'
@decorators.view
-def create(request, page=None, template=DEF_DOCS_CREATE_TMPL):
+def create(request, page_name=None, template=DEF_DOCS_CREATE_TMPL):
"""View to create a new Document entity.
Args:
@@ -130,7 +130,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
if request.method == 'POST':
form = CreateForm(request.POST)
@@ -168,7 +168,7 @@
@decorators.view
-def edit(request, page=None, partial_path=None, link_name=None,
+def edit(request, page_name=None, partial_path=None, link_name=None,
template=DEF_DOCS_EDIT_TMPL):
"""View to modify the properties of a Document Model entity.
@@ -197,7 +197,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
doc = None # assume that no Document entity will be found
@@ -211,7 +211,7 @@
except out_of_band.ErrorResponse, error:
# show custom 404 page when path doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_DOC_MSG
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
if request.method == 'POST':
form = EditForm(request.POST)
@@ -277,7 +277,7 @@
@decorators.view
-def delete(request, page=None, partial_path=None, link_name=None,
+def delete(request, page_name=None, partial_path=None, link_name=None,
template=DEF_DOCS_EDIT_TMPL):
"""Request handler to delete Document Model entity.
@@ -306,7 +306,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
existing_doc = None
path = path_link_name.combinePath([partial_path, link_name])
@@ -319,7 +319,7 @@
except out_of_band.ErrorResponse, error:
# show custom 404 page when path doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_DOC_MSG
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
if existing_doc:
document.logic.delete(existing_doc)
--- a/app/soc/views/document/list.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/document/list.py Sat Nov 15 16:17:11 2008 +0000
@@ -38,7 +38,7 @@
@decorators.view
-def all(request, page=None, templates={}):
+def all(request, page_name=None, templates={}):
"""Show a list of all Documents (limit rows per page).
Args:
@@ -60,7 +60,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
offset, limit = helper.lists.cleanListParameters(
offset=request.GET.get('offset'), limit=request.GET.get('limit'))
--- a/app/soc/views/document/show.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/document/show.py Sat Nov 15 16:17:11 2008 +0000
@@ -38,7 +38,7 @@
DEF_DOCS_PUBLIC_TMPL = 'soc/document/public.html'
@decorators.view
-def public(request, page=None, partial_path=None, link_name=None,
+def public(request, page_name=None, partial_path=None, link_name=None,
template=DEF_DOCS_PUBLIC_TMPL):
"""How the "general public" sees a Document.
@@ -79,7 +79,7 @@
link_name=link_name)
except out_of_band.ErrorResponse, error:
# show custom 404 page when Document path doesn't exist in Datastore
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
doc.content = helper.templates.unescape(doc.content)
context['entity'] = doc
--- a/app/soc/views/home.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/home.py Sat Nov 15 16:17:11 2008 +0000
@@ -39,7 +39,7 @@
DEF_HOME_PUBLIC_TMPL = 'soc/home/public.html'
@decorators.view
-def public(request, page=None, partial_path=None, link_name=None,
+def public(request, page_name=None, partial_path=None, link_name=None,
entity_type='HomeSettings',
template=DEF_HOME_PUBLIC_TMPL):
"""How the "general public" sees a "home" page.
--- a/app/soc/views/models/base.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/models/base.py Sat Nov 15 16:17:11 2008 +0000
@@ -85,7 +85,7 @@
self._rights = dicts.merge(rights, new_rights)
self._params = params
- def public(self, request, page=None, params=None, **kwargs):
+ def public(self, request, page_name=None, params=None, **kwargs):
"""Displays the public page for the entity specified by **kwargs
Args:
@@ -105,7 +105,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
entity = None
if not all(kwargs.values()):
@@ -117,7 +117,7 @@
entity = self._logic.getIfFields(key_fields)
except soc.logic.out_of_band.ErrorResponse, error:
template = params['public_template']
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
self._public(request, entity, context)
@@ -128,7 +128,7 @@
return helper.responses.respond(request, template, context)
- def create(self, request, page=None, params=None, **kwargs):
+ def create(self, request, page_name=None, params=None, **kwargs):
"""Displays the create page for this entity type
Args:
@@ -151,9 +151,9 @@
old_suffix='edit',
new_suffix='edit')
- return self.edit(request, page=page, params=params, **kwargs)
+ return self.edit(request, page_name=page_name, params=params, **kwargs)
- def edit(self, request, page=None, params=None, **kwargs):
+ def edit(self, request, page_name=None, params=None, **kwargs):
"""Displays the edit page for the entity specified by **kwargs
Args:
@@ -172,7 +172,7 @@
return alt_response.response()
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
entity = None
try:
@@ -186,7 +186,7 @@
'entity_type' : params['name'],
'create' : params['create_redirect']
}
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
if request.method == 'POST':
return self.editPost(request, entity, context, params=params)
@@ -262,7 +262,7 @@
return self._constructResponse(request, entity, context, form, params)
- def list(self, request, page=None, params=None):
+ def list(self, request, page_name=None, params=None):
"""Displays the list page for the entity type
Args:
@@ -280,7 +280,7 @@
return alt_response.response()
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
offset, limit = helper.lists.cleanListParameters(
offset=request.GET.get('offset'), limit=request.GET.get('limit'))
@@ -302,7 +302,7 @@
return helper.responses.respond(request, template, context)
- def delete(self, request, page=None, params=None, **kwargs):
+ def delete(self, request, page_name=None, params=None, **kwargs):
"""Shows the delete page for the entity specified by kwargs
Args:
@@ -322,7 +322,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
entity = None
try:
@@ -335,7 +335,7 @@
'entity_type' : params['name'],
'create' : params['create_redirect']
}
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
if not entity:
#TODO: Create a proper error page for this
--- a/app/soc/views/models/site_settings.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/models/site_settings.py Sat Nov 15 16:17:11 2008 +0000
@@ -102,7 +102,7 @@
self._logic = soc.logic.models.site_settings.logic
- def main_public(self, request, page=None, **kwargs):
+ def main_public(self, request, page_name=None, **kwargs):
"""Displays the main site settings page
Args:
@@ -115,9 +115,9 @@
values = self._logic.getMainKeyValues()
key_values = dicts.zip(keys, values)
- return self.public(request, page, **key_values)
+ return self.public(request, page_name, **key_values)
- def main_edit(self, request, page=None, **kwargs):
+ def main_edit(self, request, page_name=None, **kwargs):
"""Displays the edit page for the main site settings page
Args:
@@ -130,7 +130,7 @@
values = self._logic.getMainKeyValues()
key_values = dicts.zip(keys, values)
- return self.edit(request, page, **key_values)
+ return self.edit(request, page_name, **key_values)
view = View()
--- a/app/soc/views/models/user.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/models/user.py Sat Nov 15 16:17:11 2008 +0000
@@ -151,7 +151,7 @@
base.View.__init__(self, rights=rights, params=params)
- def editSelf(self, request, page=None, params=None, **kwargs):
+ def editSelf(self, request, page_name=None, params=None, **kwargs):
"""Displays User self edit page for the entity specified by **kwargs.
Args:
@@ -171,7 +171,7 @@
values = self._logic.getKeyValues(entity)
key_fields = dicts.zip(keys, values)
- return self.edit(request, page, params=params, **key_fields)
+ return self.edit(request, page_name, params=params, **key_fields)
def _editGet(self, request, entity, form):
"""See base.View._editGet().
--- a/app/soc/views/person/profile.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/person/profile.py Sat Nov 15 16:17:11 2008 +0000
@@ -55,7 +55,7 @@
@decorators.view
-def edit(request, page=None, program=None, link_name=None,
+def edit(request, page_name=None, program=None, link_name=None,
template='soc/person/profile/edit.html'):
"""View for a Person to modify the properties of a Person Model.
--- a/app/soc/views/settings.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/settings.py Sat Nov 15 16:17:11 2008 +0000
@@ -105,7 +105,7 @@
DEF_HOME_EDIT_TMPL = 'soc/site_settings/edit.html'
@decorators.view
-def edit(request, page=None, partial_path=None, link_name=None,
+def edit(request, page_name=None, partial_path=None, link_name=None,
logic=models.home_settings.logic,
settings_form_class=SettingsForm,
template=DEF_HOME_EDIT_TMPL):
@@ -133,7 +133,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
settings_form = None
doc_select_form = None
--- a/app/soc/views/simple.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/simple.py Sat Nov 15 16:17:11 2008 +0000
@@ -37,7 +37,7 @@
DEF_PUBLIC_TMPL = 'soc/base.html'
@decorators.view
-def public(request, page=None, template=DEF_PUBLIC_TMPL, link_name=None,
+def public(request, page_name=None, template=DEF_PUBLIC_TMPL, link_name=None,
context=None):
"""A simple template view that expects a link_name extracted from the URL.
@@ -67,13 +67,13 @@
if not context:
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
try:
if link_name:
user = accounts.getUserFromLinkNameOr404(link_name)
except out_of_band.ErrorResponse, error:
- return errorResponse(request, page, error, template, context)
+ return errorResponse(request, page_name, error, template, context)
context['link_name'] = link_name
context['link_name_user'] = user
@@ -83,7 +83,7 @@
DEF_ERROR_TMPL = 'soc/error.html'
-def errorResponse(request, page, error, template, context):
+def errorResponse(request, page_name, error, template, context):
"""Displays an error page for an out_of_band.ErrorResponse exception.
Args:
@@ -119,7 +119,7 @@
DEF_LOGIN_MSG_FMT = ugettext_lazy(
'Please <a href="%(sign_in)s">sign in</a> to continue.')
-def requestLogin(request, page, template, context=None, login_message_fmt=None):
+def requestLogin(request, page_name, template, context=None, login_message_fmt=None):
"""Displays a login request page with custom message and login link.
Args:
--- a/app/soc/views/site/settings.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/site/settings.py Sat Nov 15 16:17:11 2008 +0000
@@ -47,7 +47,7 @@
@decorators.view
-def edit(request, page=None, partial_path=None, link_name=None,
+def edit(request, page_name=None, partial_path=None, link_name=None,
logic=models.site_settings.logic,
settings_form_class=SiteSettingsForm,
template=settings_views.DEF_HOME_EDIT_TMPL):
@@ -65,7 +65,7 @@
Returns:
A subclass of django.http.HttpResponse with generated template.
"""
- return settings_views.edit(request, page=page, partial_path=partial_path,
+ return settings_views.edit(request, page_name=page_name, partial_path=partial_path,
link_name=link_name, logic=logic,
settings_form_class=settings_form_class,
template=template)
--- a/app/soc/views/site/sponsor/list.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/site/sponsor/list.py Sat Nov 15 16:17:11 2008 +0000
@@ -37,7 +37,7 @@
DEF_SITE_SPONSOR_LIST_ALL_TMPL = 'soc/models/list.html'
@decorators.view
-def all(request, page=None, template=DEF_SITE_SPONSOR_LIST_ALL_TMPL):
+def all(request, page_name=None, template=DEF_SITE_SPONSOR_LIST_ALL_TMPL):
"""Show a list of all Sponsors (limit rows per page).
Args:
@@ -59,7 +59,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
offset, limit = helper.lists.cleanListParameters(
offset=request.GET.get('offset'), limit=request.GET.get('limit'))
--- a/app/soc/views/site/sponsor/profile.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/site/sponsor/profile.py Sat Nov 15 16:17:11 2008 +0000
@@ -89,7 +89,7 @@
'a New Sponsor</a> page.'
@decorators.view
-def edit(request, page=None, link_name=None,
+def edit(request, page_name=None, link_name=None,
template=DEF_SITE_SPONSOR_PROFILE_EDIT_TMPL):
"""View for a Developer to modify the properties of a Sponsor Model entity.
@@ -113,7 +113,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
user = models.user.logic.getForFields(
{'account': users.get_current_user()}, unique=True)
@@ -126,7 +126,7 @@
except out_of_band.ErrorResponse, error:
# show custom 404 page when link name doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_SPONSOR_MSG
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
if request.method == 'POST':
if existing_sponsor:
@@ -142,7 +142,7 @@
if sponsor_form.cleaned_data.get('link_name') != link_name:
msg = DEF_SPONSOR_NO_LINKNAME_CHANGE_MSG
error = out_of_band.ErrorResponse(msg)
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
fields = {}
@@ -207,14 +207,14 @@
DEF_SITE_SPONSOR_PROFILE_CREATE_TMPL = 'soc/group/profile/edit.html'
@decorators.view
-def create(request, page=None, template=DEF_SITE_SPONSOR_PROFILE_CREATE_TMPL):
+def create(request, page_name=None, template=DEF_SITE_SPONSOR_PROFILE_CREATE_TMPL):
"""create() view is same as edit() view, but with no link_name supplied.
"""
- return edit(request, page=page, link_name=None, template=template)
+ return edit(request, page_name=page_name, link_name=None, template=template)
@decorators.view
-def delete(request, page=None, link_name=None,
+def delete(request, page_name=None, link_name=None,
template=DEF_SITE_SPONSOR_PROFILE_EDIT_TMPL):
"""Request handler for a Developer to delete Sponsor Model entity.
@@ -238,7 +238,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
existing_sponsor = None
@@ -248,7 +248,7 @@
except out_of_band.ErrorResponse, error:
# show custom 404 page when link name doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_SPONSOR_MSG
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
if existing_sponsor:
# TODO(pawel.solyga): Create specific delete method for Sponsor model
--- a/app/soc/views/site/user/list.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/site/user/list.py Sat Nov 15 16:17:11 2008 +0000
@@ -37,7 +37,7 @@
DEF_SITE_USER_LIST_ALL_TMPL = 'soc/models/list.html'
@decorators.view
-def all(request, page=None, template=DEF_SITE_USER_LIST_ALL_TMPL):
+def all(request, page_name=None, template=DEF_SITE_USER_LIST_ALL_TMPL):
"""Show a list of all Users (limit rows per page).
Args:
@@ -59,7 +59,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
offset, limit = helper.lists.cleanListParameters(
offset=request.GET.get('offset'), limit=request.GET.get('limit'))
--- a/app/soc/views/site/user/profile.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/site/user/profile.py Sat Nov 15 16:17:11 2008 +0000
@@ -96,7 +96,7 @@
DEF_SITE_USER_PROFILE_LOOKUP_TMPL = 'soc/user/lookup.html'
@decorators.view
-def lookup(request, page=None, template=DEF_SITE_USER_PROFILE_LOOKUP_TMPL):
+def lookup(request, page_name=None, template=DEF_SITE_USER_PROFILE_LOOKUP_TMPL):
"""View for a Developer to look up a User Model entity.
Args:
@@ -118,7 +118,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
user = None # assume that no User entity will be found
form = None # assume blank form needs to be displayed
@@ -263,7 +263,7 @@
'a New User</a> page.'
@decorators.view
-def edit(request, page=None, link_name=None,
+def edit(request, page_name=None, link_name=None,
template=DEF_SITE_USER_PROFILE_EDIT_TMPL):
"""View for a Developer to modify the properties of a User Model entity.
@@ -287,7 +287,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
user = None # assume that no User entity will be found
@@ -298,7 +298,7 @@
except out_of_band.ErrorResponse, error:
# show custom 404 page when link name doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_USER_MSG
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
if request.method == 'POST':
@@ -419,7 +419,7 @@
DEF_SITE_CREATE_USER_PROFILE_TMPL = 'soc/user/edit.html'
@decorators.view
-def create(request, page=None, template=DEF_SITE_CREATE_USER_PROFILE_TMPL):
+def create(request, page_name=None, template=DEF_SITE_CREATE_USER_PROFILE_TMPL):
"""View for a Developer to create a new User Model entity.
Args:
@@ -441,7 +441,7 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
if request.method == 'POST':
form = CreateForm(request.POST)
--- a/app/soc/views/sponsor/profile.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/sponsor/profile.py Sat Nov 15 16:17:11 2008 +0000
@@ -36,7 +36,7 @@
DEF_SPONSOR_PUBLIC_TMPL = 'soc/group/profile/public.html'
@decorators.view
-def public(request, page=None, link_name=None,
+def public(request, page_name=None, link_name=None,
template=DEF_SPONSOR_PUBLIC_TMPL):
"""How the "general public" sees the Sponsor profile.
@@ -52,14 +52,14 @@
"""
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- context['page'] = page
+ context['page_name'] = page_name
try:
link_name_sponsor = soc.logic.models.sponsor.logic.getIfFields(
link_name=link_name)
except out_of_band.ErrorResponse, error:
# show custom 404 page when link name doesn't exist in Datastore
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
link_name_sponsor.description = \
helper.templates.unescape(link_name_sponsor.description)
--- a/app/soc/views/user/profile.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/user/profile.py Sat Nov 15 16:17:11 2008 +0000
@@ -84,7 +84,7 @@
}
@decorators.view
-def edit(request, page=None, link_name=None,
+def edit(request, page_name=None, link_name=None,
template=DEF_USER_PROFILE_EDIT_TMPL):
"""View for a User to modify the properties of a User Model entity.
@@ -106,7 +106,7 @@
if (not account) and (not link_name):
# not logged in, and no link name, so request that the user sign in
- return simple.requestLogin(request, page, template, context,
+ return simple.requestLogin(request, page_name, template, context,
# TODO(tlarsen): /user/profile could be a link to a help page instead
login_message_fmt=ugettext_lazy(
'To create a new <a href="/user/profile">User Profile</a>'
@@ -115,7 +115,7 @@
if (not account) and link_name:
# not logged in, so show read-only public profile for link_name user
- return simple.public(request, page=page, template=template,
+ return simple.public(request, page_name=page_name, template=template,
link_name=link_name, context=context)
link_name_user = None
@@ -126,13 +126,13 @@
link_name_user = accounts.getUserFromLinkNameOr404(link_name)
except out_of_band.ErrorResponse, error:
# show custom 404 page when link name doesn't exist in Datastore
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
# link_name_user will be None here if link name was already None...
if link_name_user and (link_name_user.account != account):
# link_name_user exists but is not the currently logged in Google Account,
# so show public view for that (other) User entity
- return simple.public(request, page=page, template=template,
+ return simple.public(request, page_name=page_name, template=template,
link_name=link_name, context=context)
if request.method == 'POST':
@@ -151,7 +151,7 @@
if models.user.logic.isFormerAccount(account):
msg = DEF_USER_ACCOUNT_INVALID_MSG
error = out_of_band.ErrorResponse(msg)
- return simple.errorResponse(request, page, error, template, context)
+ return simple.errorResponse(request, page_name, error, template, context)
user = models.user.logic.updateOrCreateFromAccount(properties, account)
@@ -193,7 +193,7 @@
@decorators.view
-def create(request, page=None, template=DEF_USER_PROFILE_EDIT_TMPL):
+def create(request, page_name=None, template=DEF_USER_PROFILE_EDIT_TMPL):
"""create() view is same as edit() view, but with no link_name supplied.
"""
- return edit(request, page=page, link_name=None, template=template)
\ No newline at end of file
+ return edit(request, page_name=page_name, link_name=None, template=template)
\ No newline at end of file
--- a/app/soc/views/user/roles.py Sat Nov 15 03:12:33 2008 +0000
+++ b/app/soc/views/user/roles.py Sat Nov 15 16:17:11 2008 +0000
@@ -31,7 +31,7 @@
@decorators.view
-def dashboard(request, page=None, link_name=None,
+def dashboard(request, page_name=None, link_name=None,
template='soc/user/roles/dashboard.html'):
"""A per-User dashboard of that User's Roles on the site.
@@ -61,7 +61,7 @@
@decorators.view
-def public(request, page=None, link_name=None,
+def public(request, page_name=None, link_name=None,
template='soc/user/roles/public.html'):
"""A "general public" view of a User's Roles on the site.