Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
becomes LINK_ID, "link name" becomes "link id", etc.). Also, rename LINKNAME
to LINK_ID.
Patch by: Todd Larsen
--- a/app/soc/logic/accounts.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/accounts.py Thu Nov 20 18:50:30 2008 +0000
@@ -113,17 +113,17 @@
# TODO(tlarsen): make this generic for any Linkable and move elsewhere
-def getUserFromLinkNameOr404(link_name):
- """Like getUserFromLinkName but expects to find a user.
+def getUserFromLinkIdOr404(link_id):
+ """Like getUserFromLinkId but expects to find a user.
Raises:
out_of_band.ErrorResponse if no User entity is found
"""
- user = models.user.logic.getForFields({'link_name': link_name},
+ user = models.user.logic.getForFields({'link_id': link_id},
unique=True)
if user:
return user
raise out_of_band.ErrorResponse(
- 'There is no user with a "link name" of "%s".' % link_name, status=404)
+ 'There is no user with a "link ID" of "%s".' % link_id, status=404)
--- a/app/soc/logic/key_name.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/key_name.py Thu Nov 20 18:50:30 2008 +0000
@@ -31,24 +31,24 @@
pass
-def nameDocument(partial_path, link_name=None):
- """Returns a Document key name constructed from a path and link name.
+def nameDocument(partial_path, link_id=None):
+ """Returns a Document key name constructed from a path and link ID.
Args:
partial_path: the first portion of the path to the Document that uniquely
identifies it
- link_name: optional link name to append to path (when omitted,
- partial_path is actually the entire path, with the link_name already
+ link_id: optional link ID to append to path (when omitted,
+ partial_path is actually the entire path, with the link_id already
appended)
Raises:
- Error if partial_path and link_Name produce a "False" path (None,
+ Error if partial_path and link_id produce a "False" path (None,
empty string, etc.)
"""
path = [partial_path]
- if link_name:
- path.append(link_name)
+ if link_id:
+ path.append(link_id)
path = path_link_name.combinePath(path)
@@ -58,7 +58,7 @@
return 'Document:%s' % path
-def nameSiteSettings(partial_path, link_name):
+def nameSiteSettings(partial_path, link_id):
"""Returns a SiteSettings key name constructed from a supplied path.
Raises:
@@ -68,13 +68,13 @@
if not partial_path:
raise Error('"partial_path" must be non-False: "%s"' % partial_path)
- if not link_name:
- raise Error('"link_name" must be non-False: "%s"' % link_name)
+ if not link_id:
+ raise Error('"link_id" must be non-False: "%s"' % link_id)
- return 'SiteSettings:%s:%s' % (partial_path, link_name)
+ return 'SiteSettings:%s:%s' % (partial_path, link_id)
-def nameHomeSettings(partial_path, link_name):
+def nameHomeSettings(partial_path, link_id):
"""Returns a HomeSettings key name constructed from a supplied path.
Raises:
@@ -84,10 +84,10 @@
if not partial_path:
raise Error('"partial_path" must be non-False: "%s"' % partial_path)
- if not link_name:
- raise Error('"link_name" must be non-False: "%s"' % link_name)
+ if not link_id:
+ raise Error('"link_id" must be non-False: "%s"' % link_id)
- return 'HomeSettings:%s:%s' % (partial_path, link_name)
+ return 'HomeSettings:%s:%s' % (partial_path, link_id)
def nameUser(email):
@@ -102,31 +102,31 @@
return 'User:%s' % email
-def nameSponsor(link_name):
- """Returns a Sponsor key name constructed from a supplied link name.
+def nameSponsor(link_id):
+ """Returns a Sponsor key name constructed from a supplied link ID.
Raises:
- Error if link_name is "False" (None, empty string, etc.)
+ Error if link_id is "False" (None, empty string, etc.)
"""
- if not link_name:
- raise Error('"link_name" must be non-False: "%s"' % link_name)
+ if not link_id:
+ raise Error('"link_id" must be non-False: "%s"' % link_id)
- return 'Group/Sponsor:%s' % link_name
+ return 'Group/Sponsor:%s' % link_id
-def nameSchool(sponsor_ln, program_ln, link_name):
- """Returns a School key name constructed from link names.
+def nameSchool(sponsor_ln, program_ln, link_id):
+ """Returns a School key name constructed from link IDs.
Args:
- sponsor_ln: Sponsor link name
- program_ln: Program link name
- link_name: School link name
+ sponsor_ln: Sponsor link ID
+ program_ln: Program link ID
+ link_id: School link ID
Raises:
- Error if sponsor_ln, program_ln, and link_Name combine to produce
+ Error if sponsor_ln, program_ln, and link_id combine to produce
a "False" path (None, empty string, etc.)
"""
- path = path_link_name.combinePath([[sponsor_ln, program_ln], link_name])
+ path = path_link_name.combinePath([[sponsor_ln, program_ln], link_id])
if not path:
raise Error('"path" must be non-False: "%s"' % path)
@@ -134,19 +134,19 @@
return 'Group/School:%s' % path
-def nameOrganization(sponsor_ln, program_ln, link_name):
- """Returns a Organization key name constructed from link names.
+def nameOrganization(sponsor_ln, program_ln, link_id):
+ """Returns a Organization key name constructed from link IDs.
Args:
- sponsor_ln: Sponsor link name
- program_ln: Program link name
- link_name: Organization link name
+ sponsor_ln: Sponsor link ID
+ program_ln: Program link ID
+ link_id: Organization link ID
Raises:
- Error if sponsor_ln, program_ln, and link_Name combine to produce
+ Error if sponsor_ln, program_ln, and link_id combine to produce
a "False" path (None, empty string, etc.)
"""
- path = path_link_name.combinePath([[sponsor_ln, program_ln], link_name])
+ path = path_link_name.combinePath([[sponsor_ln, program_ln], link_id])
if not path:
raise Error('"path" must be non-False: "%s"' % path)
@@ -154,26 +154,26 @@
return 'Group/Organization:%s' % path
-def nameClub(link_name):
- """Returns a Club key name constructed from a supplied link name.
+def nameClub(link_id):
+ """Returns a Club key name constructed from a supplied link ID.
Raises:
- Error if link_name is "False" (None, empty string, etc.)
+ Error if link_id is "False" (None, empty string, etc.)
"""
- if not link_name:
- raise Error('"link_name" must be non-False: "%s"' % link_name)
+ if not link_id:
+ raise Error('"link_id" must be non-False: "%s"' % link_id)
- return 'Group/Club:%s' % link_name
+ return 'Group/Club:%s' % link_id
-def nameWork(link_name):
+def nameWork(link_id):
"""Placeholder for work namer.
"""
- if not link_name:
- raise Error('"link_name" must be non-False: "%s"' % link_name)
+ if not link_id:
+ raise Error('"link_id" must be non-False: "%s"' % link_id)
- return 'Work:%s' % link_name
+ return 'Work:%s' % link_id
def nameHost(sponsor_ln, user_ln):
--- a/app/soc/logic/models/base.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/base.py Thu Nov 20 18:50:30 2008 +0000
@@ -208,7 +208,7 @@
return entity
def getIfFields(self, fields):
- """Returns entity for supplied link name if one exists.
+ """Returns entity for supplied link ID if one exists.
Args:
fields: the fields of the entity that uniquely identifies it
@@ -218,18 +218,18 @@
* Entity for supplied fields
Raises:
- out_of_band.ErrorResponse if link name is not false, but no entity
- with the supplied link name exists in the Datastore.
+ out_of_band.ErrorResponse if link ID is not false, but no entity
+ with the supplied link ID exists in the Datastore.
"""
if not all(fields.values()):
- # exit without error, to let view know that link_name was not supplied
+ # exit without error, to let view know that link_id was not supplied
return None
entity = self.getFromFields(**fields)
if entity:
- # an entity exist for this link_name, so return that entity
+ # an entity exist for this link_id, so return that entity
return entity
format_text = ugettext_lazy('"%(key)s" is "%(value)s"')
--- a/app/soc/logic/models/document.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/document.py Thu Nov 20 18:50:30 2008 +0000
@@ -43,19 +43,19 @@
"""See base.Logic.getKeyNameValues.
"""
- return [entity.partial_path, entity.link_name]
+ return [entity.partial_path, entity.link_id]
def getKeyValuesFromFields(self, fields):
"""See base.Logic.getKeyValuesFromFields.
"""
- return [fields['partial_path'], fields['link_name']]
+ return [fields['partial_path'], fields['link_id']]
def getKeyFieldNames(self):
"""See base.Logic.getKeyFieldNames.
"""
- return ['partial_path', 'link_name']
+ return ['partial_path', 'link_id']
logic = Logic()
--- a/app/soc/logic/models/home_settings.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/home_settings.py Thu Nov 20 18:50:30 2008 +0000
@@ -42,18 +42,18 @@
"""See base.Logic.getKeyNameValues.
"""
- return [entity.partial_path, entity.link_name]
+ return [entity.partial_path, entity.link_id]
def getKeyValuesFromFields(self, fields):
"""See base.Logic.getKeyValuesFromFields.
"""
- return [fields['partial_path'], fields['link_name']]
+ return [fields['partial_path'], fields['link_id']]
def getKeyFieldNames(self):
"""See base.Logic.getKeyFieldNames.
"""
- return ['partial_path', 'link_name']
+ return ['partial_path', 'link_id']
logic = Logic()
--- a/app/soc/logic/models/host.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/host.py Thu Nov 20 18:50:30 2008 +0000
@@ -43,7 +43,7 @@
"""See base.Logic.getKeyNameValues.
"""
- return [entity.sponsor.link_name, entity.user.link_name]
+ return [entity.sponsor.link_id, entity.user.link_id]
def getKeyValuesFromFields(self, fields):
"""See base.Logic.getKeyValuesFromFields.
--- a/app/soc/logic/models/request.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/request.py Thu Nov 20 18:50:30 2008 +0000
@@ -42,7 +42,7 @@
"""See base.Logic.getKeyNameValues.
"""
- return [entity.role, entity.to.link_name, entity.requester.link_name]
+ return [entity.role, entity.to.link_id, entity.requester.link_id]
def getKeyValuesFromFields(self, fields):
"""See base.Logic.getKeyValuesFromFields.
--- a/app/soc/logic/models/site_settings.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/site_settings.py Thu Nov 20 18:50:30 2008 +0000
@@ -35,8 +35,8 @@
"""
DEF_SITE_SETTINGS_PARTIAL_PATH = 'site'
- DEF_SITE_SETTINGS_LINK_NAME = 'home'
- DEF_SITE_HOME_DOC_LINK_NAME = 'home'
+ DEF_SITE_SETTINGS_LINK_ID = 'home'
+ DEF_SITE_HOME_DOC_LINK_ID = 'home'
def __init__(self):
"""Defines the name, key_name and model for this entity.
@@ -49,7 +49,7 @@
"""
return [self.DEF_SITE_SETTINGS_PARTIAL_PATH,
- self.DEF_SITE_SETTINGS_LINK_NAME]
+ self.DEF_SITE_SETTINGS_LINK_ID]
logic = Logic()
--- a/app/soc/logic/models/sponsor.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/sponsor.py Thu Nov 20 18:50:30 2008 +0000
@@ -43,19 +43,19 @@
"""See base.Logic.getKeyNameValues.
"""
- return [entity.link_name]
+ return [entity.link_id]
def getKeyValuesFromFields(self, fields):
"""See base.Logic.getKeyValuesFromFields.
"""
- return [fields['link_name']]
+ return [fields['link_id']]
def getKeyFieldNames(self):
"""See base.Logic.getKeyFieldNames.
"""
- return ['link_name']
+ return ['link_id']
def isDeletable(self, entity):
--- a/app/soc/logic/models/user.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/user.py Thu Nov 20 18:50:30 2008 +0000
@@ -54,25 +54,25 @@
"""See base.Logic.getKeyValues.
"""
- return [entity.link_name]
+ return [entity.link_id]
def getSuffixValues(self, entity):
"""See base.Logic.getSuffixValues.
"""
- return [entity.link_name]
+ return [entity.link_id]
def getKeyValuesFromFields(self, fields):
"""See base.Logic.getKeyValuesFromFields.
"""
- return [fields['link_name']]
+ return [fields['link_id']]
def getKeyFieldNames(self):
"""See base.Logic.getKeyFieldNames.
"""
- return ['link_name']
+ return ['link_id']
def updateOrCreateFromAccount(self, properties, account):
"""Like updateOrCreateFromKeyName, but resolves account to key_name first.
@@ -85,7 +85,7 @@
key_name = user.key().name()
else:
raise
- key_name = self.getKeyNameForFields({'link_name': properties['link_name']})
+ key_name = self.getKeyNameForFields({'link_id': properties['link_id']})
return self.updateOrCreateFromKeyName(properties, key_name)
--- a/app/soc/logic/models/work.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/models/work.py Thu Nov 20 18:50:30 2008 +0000
@@ -42,19 +42,19 @@
"""See base.Logic.getKeyNameValues.
"""
- return [entity.link_name]
+ return [entity.link_id]
def getKeyValuesFromFields(self, fields):
"""See base.Logic.getKeyValuesFromFields.
"""
- return [fields['link_name']]
+ return [fields['link_id']]
def getKeyFieldNames(self):
"""See base.Logic.getKeyFieldNames.
"""
- return ['link_name']
+ return ['link_id']
logic = Logic()
--- a/app/soc/logic/path_link_name.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/path_link_name.py Thu Nov 20 18:50:30 2008 +0000
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Path and link name manipulation functions.
+"""Path and link ID manipulation functions.
"""
__authors__ = [
@@ -31,42 +31,42 @@
# -OR-
# underscore and ASCII digit or lowercase)
# zero or more of OR group
-LINKNAME_PATTERN_CORE = r'[0-9a-z](?:[0-9a-z]|_[0-9a-z])*'
-LINKNAME_ARG_PATTERN = r'(?P<link_name>%s)' % LINKNAME_PATTERN_CORE
-LINKNAME_PATTERN = r'^%s$' % LINKNAME_PATTERN_CORE
-LINKNAME_REGEX = re.compile(LINKNAME_PATTERN)
+LINK_ID_PATTERN_CORE = r'[0-9a-z](?:[0-9a-z]|_[0-9a-z])*'
+LINK_ID_ARG_PATTERN = r'(?P<link_id>%s)' % LINK_ID_PATTERN_CORE
+LINK_ID_PATTERN = r'^%s$' % LINK_ID_PATTERN_CORE
+LINK_ID_REGEX = re.compile(LINK_ID_PATTERN)
-# partial path is multiple link_name chunks,
+# partial path is multiple link_id chunks,
# each separated by a trailing /
# (at least 1)
-PARTIAL_PATH_ARG_PATTERN = (r'(?P<partial_path>%(link_name)s'
- '(?:/%(link_name)s)*)' % {
- 'link_name': LINKNAME_PATTERN_CORE})
+PARTIAL_PATH_ARG_PATTERN = (r'(?P<partial_path>%(link_id)s'
+ '(?:/%(link_id)s)*)' % {
+ 'link_id': LINK_ID_PATTERN_CORE})
PARTIAL_PATH_PATTERN = r'^%s$' % PARTIAL_PATH_ARG_PATTERN
PARTIAL_PATH_REGEX = re.compile(PARTIAL_PATH_PATTERN)
-# path is multiple link_name chunks,
+# path is multiple link_id chunks,
# each separated by a trailing /
# (at least 1)
-# followed by a single link_name with no trailing /
-PATH_LINKNAME_ARGS_PATTERN = (
+# followed by a single link_id with no trailing /
+PATH_LINK_ID_ARGS_PATTERN = (
r'%(partial_path)s/'
- '(?P<link_name>%(link_name)s)' % {
+ '(?P<link_id>%(link_id)s)' % {
'partial_path' : PARTIAL_PATH_ARG_PATTERN,
- 'link_name': LINKNAME_PATTERN_CORE})
-PATH_LINKNAME_PATTERN = r'^%s$' % PATH_LINKNAME_ARGS_PATTERN
-PATH_LINKNAME_REGEX = re.compile(PATH_LINKNAME_PATTERN)
+ 'link_id': LINK_ID_PATTERN_CORE})
+PATH_LINK_ID_PATTERN = r'^%s$' % PATH_LINK_ID_ARGS_PATTERN
+PATH_LINK_ID_REGEX = re.compile(PATH_LINK_ID_PATTERN)
def getPartsFromPath(path):
- """Splits path string into partial_path and link_name.
+ """Splits path string into partial_path and link_id.
Returns:
{'partial_path': 'everything/but',
- 'link_name': 'link_name'}
- or {} (empty dict) if string did not match PATH_LINKNAME_PATTERN.
+ 'link_id': 'link_id'}
+ or {} (empty dict) if string did not match PATH_LINK_ID_PATTERN.
"""
- path_link_name_match = PATH_LINKNAME_REGEX.match(path)
+ path_link_name_match = PATH_LINK_ID_REGEX.match(path)
if not path_link_name_match:
return {}
@@ -83,7 +83,7 @@
the list is itself a list); for example:
'a/complete/path/in/one/string'
['some', 'path', 'parts']
- [['path', 'parts', 'and', 'a'], 'link name']
+ [['path', 'parts', 'and', 'a'], 'link ID']
Returns:
None if path_parts is False (None, empty string, etc.) or if
--- a/app/soc/logic/site/map.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/site/map.py Thu Nov 20 18:50:30 2008 +0000
@@ -129,7 +129,7 @@
home_settings_edit = page.Page(
page.Url(
- r'^home/edit/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^home/edit/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.home_settings.edit'),
'Site: Settings',
short_name='Edit Site Settings',
@@ -137,7 +137,7 @@
home_settings_show = page.Page(
page.Url(
- r'^home/show/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^home/show/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.home_settings.public'),
'Show Document',
parent=home)
@@ -175,7 +175,7 @@
site_settings_edit = page.Page(
page.Url(
- r'^site/edit/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^site/edit/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.site_settings.edit'),
'Site: Settings',
short_name='Edit Site Settings',
@@ -183,14 +183,14 @@
site_settings_show = page.Page(
page.Url(
- r'^site/show/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^site/show/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.site_settings.public'),
'Show Site Settings',
parent=home)
site_settings_delete = page.Page(
page.Url(
- r'^site/delete/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^site/delete/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.site_settings.delete'),
'Delete Site Settings',
parent=home)
@@ -221,7 +221,7 @@
site_user_edit = page.Page(
page.Url(
- r'^user/edit/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
+ r'^user/edit/%s$' % path_link_name.LINK_ID_ARG_PATTERN,
'soc.views.models.user.edit'),
'Site: Modify Existing User Profile',
short_name='Modify Site User',
@@ -229,7 +229,7 @@
user_show = page.Page(
page.Url(
- r'^user/show/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
+ r'^user/show/%s$' % path_link_name.LINK_ID_ARG_PATTERN,
'soc.views.models.user.public'),
'User: Show Existing User Profile',
parent=user_signout)
@@ -244,7 +244,7 @@
user_delete = page.Page(
page.Url(
- r'^user/delete/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
+ r'^user/delete/%s$' % path_link_name.LINK_ID_ARG_PATTERN,
'soc.views.models.user.delete'),
'Site: Delete Existing User',
short_name='Delete Site User',
@@ -254,7 +254,7 @@
# Document views
document_show = page.Page(
page.Url(
- r'^document/show/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^document/show/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.document.public'),
'Show Document',
parent=home)
@@ -276,7 +276,7 @@
site_document_edit = page.Page(
page.Url(
- r'^document/edit/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^document/edit/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.document.edit'),
'Site: Modify Existing Document',
short_name='Modify Site Document',
@@ -284,7 +284,7 @@
site_document_delete = page.Page(
page.Url(
- r'^document/delete/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
+ r'^document/delete/%s$' % path_link_name.PATH_LINK_ID_ARGS_PATTERN,
'soc.views.models.document.delete'),
'Site: Delete Existing Document',
short_name='Delete Site Document',
@@ -301,7 +301,7 @@
# Sponsor Group public view
sponsor_profile = page.Page(
page.Url(
- r'^sponsor/show/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
+ r'^sponsor/show/%s$' % path_link_name.LINK_ID_ARG_PATTERN,
'soc.views.models.sponsor.public'),
'Sponsor Public Profile',
parent=home)
@@ -323,7 +323,7 @@
site_sponsor_delete = page.Page(
page.Url(
- r'^sponsor/delete/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
+ r'^sponsor/delete/%s$' % path_link_name.LINK_ID_ARG_PATTERN,
'soc.views.models.sponsor.delete'),
'Site: Delete Existing Sponsor',
short_name='Delete Site Sponsor',
@@ -331,7 +331,7 @@
site_sponsor_edit = page.Page(
page.Url(
- r'^sponsor/edit/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
+ r'^sponsor/edit/%s$' % path_link_name.LINK_ID_ARG_PATTERN,
'soc.views.models.sponsor.edit'),
'Site: Modify Existing Sponsor',
short_name='Modify Site Sponsor',
@@ -349,7 +349,7 @@
host_profile = page.Page(
page.Url(
r'^host/show/(?P<sponsor_ln>%(lnp)s)/(?P<user_ln>%(lnp)s)$' % {
- 'lnp': path_link_name.LINKNAME_PATTERN_CORE},
+ 'lnp': path_link_name.LINK_ID_PATTERN_CORE},
'soc.views.models.host.public'),
'Host Public Profile',
parent=home)
@@ -372,7 +372,7 @@
site_host_delete = page.Page(
page.Url(
r'^host/delete/(?P<sponsor_ln>%(lnp)s)/(?P<user_ln>%(lnp)s)$' % {
- 'lnp': path_link_name.LINKNAME_PATTERN_CORE},
+ 'lnp': path_link_name.LINK_ID_PATTERN_CORE},
'soc.views.models.host.delete'),
'Site: Delete Existing Host',
short_name='Delete Site Host',
@@ -381,7 +381,7 @@
site_host_edit = page.Page(
page.Url(
r'^host/edit/(?P<sponsor_ln>%(lnp)s)/(?P<user_ln>%(lnp)s)$' % {
- 'lnp': path_link_name.LINKNAME_PATTERN_CORE},
+ 'lnp': path_link_name.LINK_ID_PATTERN_CORE},
'soc.views.models.host.edit'),
'Site: Modify Existing Host',
short_name='Modify Site Host',
@@ -396,10 +396,10 @@
parent=site_host_sub_menu)
# these are not really used...
-# (r'^org/profile/(?P<program>ghop[_0-9a-z]+)/(?P<link_name>[_0-9a-z]+)/$',
+# (r'^org/profile/(?P<program>ghop[_0-9a-z]+)/(?P<link_id>[_0-9a-z]+)/$',
# 'soc.views.person.profile.edit',
# {'template': 'ghop/person/profile/edit.html'}),
-# (r'^org/profile/(?P<program>[_0-9a-z]+)/(?P<link_name>[_0-9a-z]+)/$',
+# (r'^org/profile/(?P<program>[_0-9a-z]+)/(?P<link_id>[_0-9a-z]+)/$',
# 'soc.views.person.profile.edit'),
--- a/app/soc/logic/validate.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/logic/validate.py Thu Nov 20 18:50:30 2008 +0000
@@ -45,13 +45,13 @@
return False
-def isLinkNameFormatValid(link_name):
- """Returns True if link_name is in a valid format.
+def isLinkIdFormatValid(link_id):
+ """Returns True if link_id is in a valid format.
Args:
- link_name: link name used in URLs for identification
+ link_id: link ID used in URLs for identification
"""
- if path_link_name.LINKNAME_REGEX.match(link_name):
+ if path_link_name.LINK_ID_REGEX.match(link_id):
return True
return False
@@ -60,7 +60,7 @@
"""Returns True if partial_path is in a valid format.
Args:
- partial_path: partial path prepended to link name
+ partial_path: partial path prepended to link ID
used for identification.
"""
--- a/app/soc/models/answer.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/models/answer.py Thu Nov 20 18:50:30 2008 +0000
@@ -80,7 +80,7 @@
#: contain a single string that is a free-form text answer.
#:
#: For Questions that *are* multiple-choice, this list will contain one
- #: or more short, plain-text, "link_name-like" strings representing the
+ #: or more short, plain-text, "link_id-like" strings representing the
#: "encoded" answer choices (see the choice_ids property in
#: soc.models.question.Question). For such multiple-choice Questions,
#: how many strings are stored depends on the max_answers property of
--- a/app/soc/models/group.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/models/group.py Thu Nov 20 18:50:30 2008 +0000
@@ -42,11 +42,11 @@
verbose_name=ugettext_lazy('Name'))
name.help_text = ugettext_lazy('Complete, formal name of the group.')
- #: Required field storing link_name used in URLs to identify group.
+ #: Required field storing link_id used in URLs to identify group.
#: Lower ASCII characters only.
- link_name = db.StringProperty(required=True,
- verbose_name=ugettext_lazy('Link name'))
- link_name.help_text = ugettext_lazy(
+ link_id = db.StringProperty(required=True,
+ verbose_name=ugettext_lazy('Link ID'))
+ link_id.help_text = ugettext_lazy(
'Field used in URLs to identify group. '
'Lower ASCII characters only.')
--- a/app/soc/models/home_settings.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/models/home_settings.py Thu Nov 20 18:50:30 2008 +0000
@@ -52,13 +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 Setting URL.
+ #: Required path, prepended to a "link ID" to form the Setting URL.
partial_path = db.StringProperty(required=True,
verbose_name=ugettext_lazy('Settings partial path'))
partial_path.help_text = ugettext_lazy(
- 'path portion of URLs for Settings, prepended to link name')
+ 'path portion of URLs for Settings, prepended to link ID')
- #: Required link name, appended to a "path" to form the Setting URL.
- link_name = db.StringProperty(required=True,
- verbose_name=ugettext_lazy('Setttings link name'))
- link_name.help_text = ugettext_lazy('link name for Settings used in URLs')
+ #: Required link ID, appended to a "path" to form the Setting URL.
+ link_id = db.StringProperty(required=True,
+ verbose_name=ugettext_lazy('Setttings link ID'))
+ link_id.help_text = ugettext_lazy('link ID for Settings used in URLs')
--- a/app/soc/models/question.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/models/question.py Thu Nov 20 18:50:30 2008 +0000
@@ -45,10 +45,10 @@
on during creation or annotated once put into use).
work.partial_path: used to scope (and, when combined with
- work.link_name, uniquely identify) a Question in the same way the
+ work.link_id, uniquely identify) a Question in the same way the
property are used with Documents, etc.
- work.link_name: used to identify (and, when combined with
+ work.link_id: used to identify (and, when combined with
work.partial_path, *uniquely* identify) a Question in the same way
these properties are used with Documents, etc.
@@ -87,18 +87,18 @@
are here now so that the concepts will not be lost before that time.
The recommended use for the combination of work.partial_path and
- work.link_name is to keep the *same* link_name when copying and
+ work.link_id is to keep the *same* link_id when copying and
modifying an existing Question for a new Program (or instance of a
Group that is per-Program), while changing the work.partial_path to
represent the Program and Group "ownership" of the Question. For
example, if a Question asking about prior GSoC participation needed
to have an additional choice (see the choice_ids and choices properties
- below), it is desirable to keep the same work.link_name (and also
+ below), it is desirable to keep the same work.link_id (and also
simply append new choice_ids and choices to keep the old answer values
compatible). An existing Question in the above example might be identified
as something like:
Question:google/gsoc2009/gsoc_past_participation
- <type>:<Sponsor>/<Program>/<link_name>
+ <type>:<Sponsor>/<Program>/<link_id>
To make it possible to query for gsoc_past_participation answers regardless
of the Program, the next year, new values are added to choice_ids and
choices in a new Question copied from the one above, which would then
@@ -114,7 +114,7 @@
combination with GSoC, the gsoc_past_participation Question would be
duplicated (unaltered) to something like:
Question:google/ghop2009/gsoc_past_participation
- To get the combined results, query on a link_name of
+ To get the combined results, query on a link_id of
gsoc_past_participation. For more targeted results, include the
partial_path to make the query more specific.
@@ -126,7 +126,7 @@
A dynamic form is most definitely going to be needed to implement the
Question creation and editing for multiple-choice questions.
"""
- #: db.ListProperty of short, plain-text, "link_name-like" strings
+ #: db.ListProperty of short, plain-text, "link_id-like" strings
#: representing the "encoded" answer choices (must be strings compatible
#: with being query arguments and being used in HTML controls and POST
#: responses).
--- a/app/soc/models/quiz.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/models/quiz.py Thu Nov 20 18:50:30 2008 +0000
@@ -52,7 +52,7 @@
work.reviews: even Quizzes can be "reviewed" (possibly commented
on during creation or annotated once put into use).
- work.partial_path/work.link_name: used to scope and uniquely identify
+ work.partial_path/work.link_id: used to scope and uniquely identify
a Quiz in the same way these properties are used with Documents, etc.
work.content: the "preface" of the Quiz, displayed before any
--- a/app/soc/models/user.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/models/user.py Thu Nov 20 18:50:30 2008 +0000
@@ -79,11 +79,11 @@
nick_name = db.StringProperty(required=True,
verbose_name=ugettext_lazy('Nick name'))
- #: Required field storing link_name used in URLs to identify user.
+ #: Required field storing link_id used in URLs to identify user.
#: Lower ASCII characters only.
- link_name = db.StringProperty(required=True,
- verbose_name=ugettext_lazy('Link name'))
- link_name.help_text = ugettext_lazy(
+ link_id = db.StringProperty(required=True,
+ verbose_name=ugettext_lazy('Link ID'))
+ link_id.help_text = ugettext_lazy(
'Field used in URLs to identify user. '
'Lower ASCII characters only.')
--- a/app/soc/models/work.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/models/work.py Thu Nov 20 18:50:30 2008 +0000
@@ -57,23 +57,23 @@
title.help_text = ugettext_lazy(
'title of the document; often used in the window title')
- #: Required path, prepended to a "link name" to form the document URL.
- #: The combined path and link name must be globally unique on the
+ #: Required path, prepended to a "link ID" to form the document URL.
+ #: The combined path and link ID must be globally unique on the
#: site. Except in /site/document (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.
partial_path = db.StringProperty(required=True,
verbose_name=ugettext_lazy('Partial path'))
partial_path.help_text = ugettext_lazy(
- 'path portion of URLs, prepended to link name')
+ 'path portion of URLs, prepended to link ID')
- #: 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,
+ #: Required link ID, appended to a "path" to form the document URL.
+ #: The combined path and link ID must be globally unique on the
+ #: site (but, unlike some link IDs, a Work link ID can be reused,
#: as long as the combination with the preceding path is unique).
- link_name = db.StringProperty(required=True,
- verbose_name=ugettext_lazy('Link name'))
- link_name.help_text = ugettext_lazy('link name used in URLs')
+ link_id = db.StringProperty(required=True,
+ verbose_name=ugettext_lazy('Link ID'))
+ link_id.help_text = ugettext_lazy('link ID used in URLs')
#: short name used in places such as the sidebar menu and breadcrumb trail
#: (optional: title will be used if short_name is not present)
--- a/app/soc/templates/soc/document/list/docs_row.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/document/list/docs_row.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,15 +1,15 @@
<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
-onclick="document.location.href='/document/edit/{{ data_element.partial_path }}/{{ data_element.link_name }}'" name="name">
+onclick="document.location.href='/document/edit/{{ data_element.partial_path }}/{{ data_element.link_id }}'" name="name">
<td align="right">
<div class="title">
<a class="noul"
- href="/document/edit/{{ data_element.partial_path }}/{{ data_element.link_name }}">{{ data_element.partial_path}}/{{ data_element.link_name }}</a>
+ href="/document/edit/{{ data_element.partial_path }}/{{ data_element.link_id }}">{{ data_element.partial_path}}/{{ data_element.link_id }}</a>
</div>
</td>
<td><div class="title">{{ data_element.title }}</div></td>
- <td><div class="link_name">{{ data_element.link_name }}</div></td>
+ <td><div class="link_id">{{ data_element.link_id }}</div></td>
<td><div class="featured">{{ data_element.is_featured }}</div></td>
- <td><div class="author">{{ data_element.author.link_name }}</div></td>
+ <td><div class="author">{{ data_element.author.link_id }}</div></td>
<td><div class="created">{{ data_element.created }}</div></td>
<td><div class="modified">{{ data_element.modified }}</div></td>
</tr>
--- a/app/soc/templates/soc/group/list/group_heading.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/group/list/group_heading.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,5 +1,5 @@
<tr align="left">
<th class="first" align="right">Name</th>
- <th>Link name</th>
+ <th>Link ID</th>
<th>Short name</th>
</tr>
--- a/app/soc/templates/soc/group/list/group_row.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/group/list/group_row.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,9 +1,9 @@
<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
-onclick="document.location.href='/{{ entity_type|lower }}/edit/{{ data_element.link_name }}'" name="name">
+onclick="document.location.href='/{{ entity_type|lower }}/edit/{{ data_element.link_id }}'" name="name">
<td align="right"><div class="name"><a class="noul"
- href="/{{ entity_type|lower }}/edit/{{ data_element.link_name }}">{{ data_element.name }}</a>
+ href="/{{ entity_type|lower }}/edit/{{ data_element.link_id }}">{{ data_element.name }}</a>
</div>
</td>
- <td><div class="link_name">{{ data_element.link_name }}</a></div></td>
+ <td><div class="link_id">{{ data_element.link_id }}</a></div></td>
<td><div class="short_name">{{ data_element.short_name }}</div></td>
</tr>
--- a/app/soc/templates/soc/home_settings/list/home_row.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/home_settings/list/home_row.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,10 +1,10 @@
<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
-onclick="document.location.href='/home/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_name }}'" name="name">
+onclick="document.location.href='/home/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_id }}'" name="name">
<td align="right">
<div class="title">
<a class="noul"
- href="/home/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_name }}">{{ data_element.partial_path}}/{{ data_element.link_name }}</a>
+ href="/home/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_id }}">{{ data_element.partial_path}}/{{ data_element.link_id }}</a>
</div>
</td>
- <td><div class="link_name">{{ data_element.home.title }}</div></td>
+ <td><div class="link_id">{{ data_element.home.title }}</div></td>
</tr>
--- a/app/soc/templates/soc/host/list/host_heading.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/host/list/host_heading.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,5 +1,5 @@
<tr align="left">
- <th class="first" align="right">User link name</th>
+ <th class="first" align="right">User link ID</th>
<th>Sponsor name</th>
<th>Given name</th>
<th>Surname</th>
--- a/app/soc/templates/soc/host/list/host_row.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/host/list/host_row.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,7 +1,7 @@
<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
-onclick="document.location.href='/{{ entity_type|lower }}/edit/{{ data_element.sponsor.link_name }}/{{ data_element.user.link_name }}'" name="name">
- <td align="right"><div class="user_link_name"><a class="noul"
- href="/{{ entity_type|lower }}/edit/{{ data_element.sponsor.link_name }}/{{ data_element.user.link_name }}">{{ data_element.user.link_name }}</a>
+onclick="document.location.href='/{{ entity_type|lower }}/edit/{{ data_element.sponsor.link_id }}/{{ data_element.user.link_id }}'" name="name">
+ <td align="right"><div class="user_link_id"><a class="noul"
+ href="/{{ entity_type|lower }}/edit/{{ data_element.sponsor.link_id }}/{{ data_element.user.link_id }}">{{ data_element.user.link_id }}</a>
</div>
</td>
<td><div class="sponsor_name">{{ data_element.sponsor.name }}</div></td>
--- a/app/soc/templates/soc/request/list/request_row.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/request/list/request_row.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,11 +1,11 @@
<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
-onclick="document.location.href='/{{ entity_type|lower }}/edit/{{ data_element.role|lower }}/{{ data_element.to.link_name }}/{{ data_element.requester.link_name }}'" name="name">
- <td align="right"><div class="user_link_name"><a class="noul"
- href="/{{ entity_type|lower }}/edit/{{ data_element.role|lower }}/{{ data_element.to.link_name }}/{{ data_element.requester.link_name }}">{{ data_element.requester.link_name }}</a>
+onclick="document.location.href='/{{ entity_type|lower }}/edit/{{ data_element.role|lower }}/{{ data_element.to.link_id }}/{{ data_element.requester.link_id }}'" name="name">
+ <td align="right"><div class="user_link_id"><a class="noul"
+ href="/{{ entity_type|lower }}/edit/{{ data_element.role|lower }}/{{ data_element.to.link_id }}/{{ data_element.requester.link_id }}">{{ data_element.requester.link_id }}</a>
</div>
</td>
<td><div class="role">{{ data_element.role }}</div></td>
- <td><div class="to">{{ data_element.to.link_name }}</div></td>
+ <td><div class="to">{{ data_element.to.link_id }}</div></td>
<td><div class="accepted">{{ data_element.accepted }}</div></td>
<td><div class="declined">{{ data_element.declined }}</div></td>
</tr>
--- a/app/soc/templates/soc/request/public.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/request/public.html Thu Nov 20 18:50:30 2008 +0000
@@ -15,15 +15,15 @@
{% load forms_helpers %}
{% block header_title %}
-{{ page_name }} for {{ entity.requester.link_name }}
+{{ page_name }} for {{ entity.requester.link_id }}
{% endblock %}
{% block body %}
<p>
<table>
{% readonly_field_as_table_row entity.fields.role.label entity.role %}
- {% readonly_field_as_table_row entity.fields.requester.label entity.requester.link_name %}
- {% readonly_field_as_table_row entity.fields.to.label entity.to.link_name %}
+ {% readonly_field_as_table_row entity.fields.requester.label entity.requester.link_id %}
+ {% readonly_field_as_table_row entity.fields.to.label entity.to.link_id %}
{% readonly_field_as_table_row entity.fields.accepted.label entity.accepted %}
{% readonly_field_as_table_row entity.fields.declined.label entity.declined %}
<!-- TODO(pawel.solyga) make this generic -->
--- a/app/soc/templates/soc/site_settings/edit.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/site_settings/edit.html Thu Nov 20 18:50:30 2008 +0000
@@ -49,13 +49,13 @@
<tr>
<th>Path:</th>
<td colspan="2">
- {{ home_doc.partial_path }}/{{ home_doc.link_name }}
+ {{ home_doc.partial_path }}/{{ home_doc.link_id }}
</td>
</tr>
<tr>
<th>Created By:</th>
<td colspan="2">
- {{ home_doc.author.link_name }}
+ {{ home_doc.author.link_id }}
</td>
</tr>
<tr>
--- a/app/soc/templates/soc/site_settings/list/site_row.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/site_settings/list/site_row.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,10 +1,10 @@
<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
-onclick="document.location.href='/site/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_name }}'" name="name">
+onclick="document.location.href='/site/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_id }}'" name="name">
<td align="right">
<div class="title">
<a class="noul"
- href="/site/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_name }}">{{ data_element.partial_path}}/{{ data_element.link_name }}</a>
+ href="/site/settings/edit/{{ data_element.partial_path }}/{{ data_element.link_id }}">{{ data_element.partial_path}}/{{ data_element.link_id }}</a>
</div>
</td>
- <td><div class="link_name">{{ data_element.home.title }}</div></td>
+ <td><div class="link_id">{{ data_element.home.title }}</div></td>
</tr>
--- a/app/soc/templates/soc/sponsor/edit.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/sponsor/edit.html Thu Nov 20 18:50:30 2008 +0000
@@ -16,6 +16,6 @@
{% block submit_buttons %}
{{ block.super }}
<td>
- <input type="button" onclick="location.href='/host/invite/{{ entity.link_name }}'" value="Invite Host"/>
+ <input type="button" onclick="location.href='/host/invite/{{ entity.link_id }}'" value="Invite Host"/>
</td>
{% endblock %}
--- a/app/soc/templates/soc/user/edit.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/user/edit.html Thu Nov 20 18:50:30 2008 +0000
@@ -42,7 +42,7 @@
</td>
</tr>
{% endif %}
- {% field_as_table_row form.link_name %}
+ {% field_as_table_row form.link_id %}
{% field_as_table_row form.nick_name %}
{% field_as_table_row form.is_developer %}
{% if existing_user.former_accounts %}
--- a/app/soc/templates/soc/user/edit_self.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/user/edit_self.html Thu Nov 20 18:50:30 2008 +0000
@@ -31,7 +31,7 @@
<form method="POST">
<table>
{% field_as_table_row form.nick_name %}
- {% field_as_table_row form.link_name %}
+ {% field_as_table_row form.link_id %}
<tr>
<td colspan="4"> </td>
</tr>
--- a/app/soc/templates/soc/user/list/user_row.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/user/list/user_row.html Thu Nov 20 18:50:30 2008 +0000
@@ -1,10 +1,10 @@
<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
-onclick="document.location.href='{{redirect_action|lower}}/{{ data_element.link_name }}'" name="name">
+onclick="document.location.href='{{redirect_action|lower}}/{{ data_element.link_id }}'" name="name">
<td align="right"><div class="account"><a class="noul"
- href="{{redirect_action|lower}}/{{ data_element.link_name }}">{{ data_element.account }}</a>
+ href="{{redirect_action|lower}}/{{ data_element.link_id }}">{{ data_element.account }}</a>
</div>
</td>
<td><div class="email">{{ data_element.account.email }}</a></div></td>
<td><div class="nick_name">{{ data_element.nick_name }}</div></td>
- <td><div class="link_name">{{ data_element.link_name }}</div></td>
+ <td><div class="link_id">{{ data_element.link_id }}</div></td>
</tr>
--- a/app/soc/templates/soc/user/lookup.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/user/lookup.html Thu Nov 20 18:50:30 2008 +0000
@@ -34,15 +34,15 @@
</tr>
{% endif %}
{% field_as_table_row form.account %}
-{% if link_name_error %}
+{% if link_id_error %}
<tr>
<td> </td>
<td colspan="3" class="formfielderror">
- {{ link_name_error }}
+ {{ link_id_error }}
</td>
</tr>
{% endif %}
- {% field_as_table_row form.link_name %}
+ {% field_as_table_row form.link_id %}
{% if found_user %}
<tr>
<td class="formfieldlabel">Nick name</td>
--- a/app/soc/templates/soc/user/public.html Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/templates/soc/user/public.html Thu Nov 20 18:50:30 2008 +0000
@@ -21,7 +21,7 @@
{% block body %}
<p>
<table>
- {% readonly_field_as_table_row entity.fields.link_name.label entity.link_name %}
+ {% readonly_field_as_table_row entity.fields.link_id.label entity.link_id %}
{% readonly_field_as_table_row entity.fields.nick_name.label entity.nick_name %}
<!-- TODO(pawel.solyga) make this generic -->
</table>
--- a/app/soc/views/document/edit.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/document/edit.py Thu Nov 20 18:50:30 2008 +0000
@@ -63,11 +63,11 @@
user = users.get_current_user()
partial_path = form.cleaned_data.get('partial_path')
- link_name = form.cleaned_data.get('link_name')
+ link_id = form.cleaned_data.get('link_id')
properties = {}
properties['partial_path'] = partial_path
- properties['link_name'] = link_name
+ properties['link_id'] = link_id
properties['title'] = form.cleaned_data.get('title')
properties['short_name'] = form.cleaned_data.get('short_name')
properties['content'] = form.cleaned_data.get('content')
@@ -94,13 +94,13 @@
def clean_partial_path(self):
partial_path = self.cleaned_data.get('partial_path')
- # TODO(tlarsen): combine path and link_name and check for uniqueness
+ # TODO(tlarsen): combine path and link_id and check for uniqueness
return partial_path
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- # TODO(tlarsen): combine path and link_name and check for uniqueness
- return link_name
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ # TODO(tlarsen): combine path and link_id and check for uniqueness
+ return link_id
DEF_DOCS_CREATE_TMPL = 'soc/models/edit.html'
@@ -140,7 +140,7 @@
if not doc:
return http.HttpResponseRedirect('/')
- new_path = path_link_name.combinePath([doc.partial_path, doc.link_name])
+ new_path = path_link_name.combinePath([doc.partial_path, doc.link_id])
# redirect to new /document/edit/new_path?s=0
# (causes 'Profile saved' message to be displayed)
@@ -148,7 +148,7 @@
request, None, new_path,
params=profile.SUBMIT_PROFILE_SAVED_PARAMS)
else: # method == 'GET':
- # no link name specified, so start with an empty form
+ # no link ID specified, so start with an empty form
form = CreateForm()
context['form'] = form
@@ -167,7 +167,7 @@
@decorators.view
-def edit(request, page_name=None, partial_path=None, link_name=None,
+def edit(request, page_name=None, partial_path=None, link_id=None,
template=DEF_DOCS_EDIT_TMPL):
"""View to modify the properties of a Document Model entity.
@@ -175,8 +175,8 @@
request: the standard django request object
page_name: the page name displayed in templates as page and header title
partial_path: the Document's site-unique "path" extracted from the URL,
- minus the trailing link_name
- link_name: the last portion of the Document's site-unique "path"
+ minus the trailing link_id
+ link_id: the last portion of the Document's site-unique "path"
extracted from the URL
template: the "sibling" template (or a search list of such templates)
from which to construct the public.html template name (or names)
@@ -199,13 +199,13 @@
doc = None # assume that no Document entity will be found
- path = path_link_name.combinePath([partial_path, link_name])
+ path = path_link_name.combinePath([partial_path, link_id])
# try to fetch Document entity corresponding to path if one exists
try:
if path:
doc = document.logic.getFromFields(partial_path=partial_path,
- link_name=link_name)
+ link_id=link_id)
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
@@ -220,7 +220,7 @@
if not doc:
return http.HttpResponseRedirect('/')
- new_path = path_link_name.combinePath([doc.partial_path, doc.link_name])
+ new_path = path_link_name.combinePath([doc.partial_path, doc.link_id])
# redirect to new /document/edit/new_path?s=0
# (causes 'Profile saved' message to be displayed)
@@ -246,12 +246,12 @@
values=SUBMIT_MESSAGES))
# populate form with the existing Document entity
- author_link_name = doc.author.link_name
+ author_link_id = doc.author.link_id
form = EditForm(initial={'doc_key_name': doc.key().name(),
'title': doc.title, 'partial_path': doc.partial_path,
- 'link_name': doc.link_name, 'short_name': doc.short_name,
+ 'link_id': doc.link_id, 'short_name': doc.short_name,
'content': doc.content, 'author': doc.author,
- 'is_featured': doc.is_featured, 'created_by': author_link_name})
+ 'is_featured': doc.is_featured, 'created_by': author_link_id})
else:
if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME):
# redirect to aggressively remove 'Profile saved' query parameter
@@ -259,13 +259,13 @@
context['lookup_error'] = ugettext_lazy(
'Document with that path not found.')
- form = EditForm(initial={'link_name': link_name})
- else: # no link name specified in the URL
+ form = EditForm(initial={'link_id': link_id})
+ else: # no link ID specified in the URL
if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME):
# redirect to aggressively remove 'Profile saved' query parameter
return http.HttpResponseRedirect(request.path)
- # no link name specified, so start with an empty form
+ # no link ID specified, so start with an empty form
form = EditForm()
context.update({'form': form,
@@ -275,7 +275,7 @@
@decorators.view
-def delete(request, page_name=None, partial_path=None, link_name=None,
+def delete(request, page_name=None, partial_path=None, link_id=None,
template=DEF_DOCS_EDIT_TMPL):
"""Request handler to delete Document Model entity.
@@ -283,8 +283,8 @@
request: the standard django request object
page_name: the page name displayed in templates as page and header title
partial_path: the Document's site-unique "path" extracted from the URL,
- minus the trailing link_name
- link_name: the last portion of the Document's site-unique "path"
+ minus the trailing link_id
+ link_id: the last portion of the Document's site-unique "path"
extracted from the URL
template: the "sibling" template (or a search list of such templates)
from which to construct the public.html template name (or names)
@@ -306,13 +306,13 @@
context['page_name'] = page_name
existing_doc = None
- path = path_link_name.combinePath([partial_path, link_name])
+ path = path_link_name.combinePath([partial_path, link_id])
# try to fetch Document entity corresponding to path if one exists
try:
if path:
existing_doc = document.logic.getFromFields(partial_path=partial_path,
- link_name=link_name)
+ link_id=link_id)
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
--- a/app/soc/views/document/show.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/document/show.py Thu Nov 20 18:50:30 2008 +0000
@@ -38,7 +38,7 @@
DEF_DOCS_PUBLIC_TMPL = 'soc/document/public.html'
@decorators.view
-def public(request, page_name=None, partial_path=None, link_name=None,
+def public(request, page_name=None, partial_path=None, link_id=None,
template=DEF_DOCS_PUBLIC_TMPL):
"""How the "general public" sees a Document.
@@ -46,8 +46,8 @@
request: the standard django request object
page_name: the page name displayed in templates as page and header title
partial_path: the Document's site-unique "path" extracted from the URL,
- minus the trailing link_name
- link_name: the last portion of the Document's site-unique "path"
+ minus the trailing link_id
+ link_id: the last portion of the Document's site-unique "path"
extracted from the URL
template: the "sibling" template (or a search list of such templates)
from which to construct the public.html template name (or names)
@@ -68,14 +68,14 @@
doc = None
- # try to fetch User entity corresponding to link_name if one exists
- path = path_link_name.combinePath([partial_path, link_name])
+ # try to fetch User entity corresponding to link_id if one exists
+ path = path_link_name.combinePath([partial_path, link_id])
# try to fetch Document entity corresponding to path if one exists
try:
if path:
doc = document.logic.getFromFields(partial_path=partial_path,
- link_name=link_name)
+ link_id=link_id)
except out_of_band.ErrorResponse, error:
# show custom 404 page when Document path doesn't exist in Datastore
return simple.errorResponse(request, page_name, error, template, context)
--- a/app/soc/views/helper/requests.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/helper/requests.py Thu Nov 20 18:50:30 2008 +0000
@@ -101,7 +101,7 @@
request.path; default is None (use request.path)
suffix: suffix to remove from the HTTP request path before comparing
it to the HTTP referrer path in the HTTP request object headers
- (this is often an link name, for example, that may be changing from
+ (this is often an link ID, for example, that may be changing from
a POST referrer to a GET redirect target)
Returns:
@@ -124,7 +124,7 @@
expected_prefix = request.path
if suffix:
- # remove suffix (such as a link name) before comparison
+ # remove suffix (such as a link ID) before comparison
chars_to_remove = len(suffix)
if not suffix.startswith('/'):
@@ -144,7 +144,7 @@
"""Replace the last part of a URL path with something else.
Also appends an optional list of query parameters. Used for
- replacing, for example, one link name at the end of a relative
+ replacing, for example, one link ID at the end of a relative
URL path with another.
Args:
--- a/app/soc/views/helper/responses.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/helper/responses.py Thu Nov 20 18:50:30 2008 +0000
@@ -109,7 +109,7 @@
settings = site_settings.logic.getFromFields(
partial_path=site_settings.logic.DEF_SITE_SETTINGS_PARTIAL_PATH,
- link_name=site_settings.logic.DEF_SITE_SETTINGS_LINK_NAME)
+ link_id=site_settings.logic.DEF_SITE_SETTINGS_LINK_ID)
if settings:
context['ga_tracking_num'] = settings.ga_tracking_num
--- a/app/soc/views/home.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/home.py Thu Nov 20 18:50:30 2008 +0000
@@ -39,7 +39,7 @@
DEF_HOME_PUBLIC_TMPL = 'soc/home/public.html'
@decorators.view
-def public(request, page_name=None, partial_path=None, link_name=None,
+def public(request, page_name=None, partial_path=None, link_id=None,
entity_type='HomeSettings',
template=DEF_HOME_PUBLIC_TMPL):
"""How the "general public" sees a "home" page.
@@ -47,7 +47,7 @@
Args:
request: the standard django request object.
page_name: the page name displayed in templates as page and header title
- path: path (entire "scoped" portion combined with the link_name)
+ path: path (entire "scoped" portion combined with the link_id)
used to retrieve the Group's "home" settings
template: the template path to use for rendering the template
@@ -58,7 +58,7 @@
context = helper.responses.getUniversalContext(request)
settings = models.site_settings.logic.getFromFields(
- partial_path=partial_path, link_name=link_name)
+ partial_path=partial_path, link_id=link_id)
if settings:
context['home_settings'] = settings
--- a/app/soc/views/models/base.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/base.py Thu Nov 20 18:50:30 2008 +0000
@@ -519,7 +519,7 @@
patterns = params['key_fields_prefix']
for name in names:
- pattern = r'(?P<%s>%s)' % (name, path_link_name.LINKNAME_PATTERN_CORE)
+ pattern = r'(?P<%s>%s)' % (name, path_link_name.LINK_ID_PATTERN_CORE)
patterns.append(pattern)
result = '/'.join(patterns)
@@ -607,8 +607,8 @@
url = url % {
'url_name': params['url_name'],
- 'lnp': path_link_name.LINKNAME_ARG_PATTERN,
- 'ulnp': path_link_name.LINKNAME_PATTERN_CORE,
+ 'lnp': path_link_name.LINK_ID_ARG_PATTERN,
+ 'ulnp': path_link_name.LINK_ID_PATTERN_CORE,
'key_fields': key_fields_pattern,
}
--- a/app/soc/views/models/document.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/document.py Thu Nov 20 18:50:30 2008 +0000
@@ -56,17 +56,17 @@
def clean_partial_path(self):
partial_path = self.cleaned_data.get('partial_path')
- # TODO(tlarsen): combine path and link_name and check for uniqueness
+ # TODO(tlarsen): combine path and link_id and check for uniqueness
if not validate.isPartialPathFormatValid(partial_path):
raise forms.ValidationError("This partial path is in wrong format.")
return partial_path
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- # TODO(tlarsen): combine path and link_name and check for uniqueness
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
- return link_name
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ # TODO(tlarsen): combine path and link_id and check for uniqueness
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
+ return link_id
class EditForm(CreateForm):
@@ -140,7 +140,7 @@
"""See base.View._editGet().
"""
- form.fields['created_by'].initial = entity.author.link_name
+ form.fields['created_by'].initial = entity.author.link_id
form.fields['doc_key_name'].initial = entity.key().name(),
--- a/app/soc/views/models/home_settings.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/home_settings.py Thu Nov 20 18:50:30 2008 +0000
@@ -57,9 +57,9 @@
# TODO(tlarsen): actually, using these two text fields to specify
# the Document is pretty cheesy; this needs to be some much better
# Role-scoped Document selector that we don't have yet
- doc_link_name = forms.CharField(required=False,
- label=ugettext_lazy('Document link name'),
- help_text=soc.models.work.Work.link_name.help_text)
+ doc_link_id = forms.CharField(required=False,
+ label=ugettext_lazy('Document link ID'),
+ help_text=soc.models.work.Work.link_id.help_text)
def clean_feed_url(self):
feed_url = self.cleaned_data.get('feed_url')
@@ -167,7 +167,7 @@
try:
if entity.home:
form.fields['doc_partial_path'].initial = entity.home.partial_path
- form.fields['doc_link_name'].initial = entity.home.link_name
+ form.fields['doc_link_id'].initial = entity.home.link_id
except db.Error:
pass
@@ -176,11 +176,11 @@
"""
doc_partial_path = fields['doc_partial_path']
- doc_link_name = fields['doc_link_name']
+ doc_link_id = fields['doc_link_id']
# 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)
+ partial_path=doc_partial_path, link_id=doc_link_id)
fields['home'] = home_doc
--- a/app/soc/views/models/host.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/host.py Thu Nov 20 18:50:30 2008 +0000
@@ -90,7 +90,7 @@
params['logic'] = soc.logic.models.host.logic
params['group_logic'] = soc.logic.models.sponsor.logic
- params['invite_filter'] = {'group_ln': 'link_name'}
+ params['invite_filter'] = {'group_ln': 'link_id'}
params['name'] = "Host"
params['name_short'] = "Host"
--- a/app/soc/views/models/request.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/request.py Thu Nov 20 18:50:30 2008 +0000
@@ -68,12 +68,12 @@
def clean_user(self):
self.cleaned_data['requester'] = user_logic.logic.getForFields(
- {'link_name': self.cleaned_data['user']}, unique=True)
+ {'link_id': self.cleaned_data['user']}, unique=True)
return self.cleaned_data['user']
def clean_group(self):
self.cleaned_data['to'] = sponsor_logic.logic.getFromFields(
- link_name=self.cleaned_data['group'])
+ link_id=self.cleaned_data['group'])
return self.cleaned_data['group']
@@ -149,16 +149,16 @@
"""
# fill in the email field with the data from the entity
- form.fields['user'].initial = entity.requester.link_name
- form.fields['group'].initial = entity.to.link_name
+ form.fields['user'].initial = entity.requester.link_id
+ form.fields['group'].initial = entity.to.link_id
def _editPost(self, request, entity, fields):
"""See base.View._editPost().
"""
# fill in the account field with the user created from email
- fields['user_ln'] = fields['requester'].link_name
- fields['group_ln'] = fields['to'].link_name
+ fields['user_ln'] = fields['requester'].link_id
+ fields['group_ln'] = fields['to'].link_id
view = View()
--- a/app/soc/views/models/role.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/role.py Thu Nov 20 18:50:30 2008 +0000
@@ -87,7 +87,7 @@
new_params['list_template'] = 'soc/models/create_invite.html'
new_params['list_redirect_action'] = '/request/create/%s/%s' % (
- self._params['url_name'], kwargs['link_name'])
+ self._params['url_name'], kwargs['link_id'])
new_params['list_redirect_entity'] = self._params['name']
new_params['name'] = self._params['name']
new_params['name_short'] = self._params['name_short']
--- a/app/soc/views/models/site_settings.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/site_settings.py Thu Nov 20 18:50:30 2008 +0000
@@ -52,11 +52,11 @@
model = soc.models.site_settings.SiteSettings
#: list of model fields which will *not* be gathered by the form
- exclude = ['inheritance_line', 'home', 'partial_path', 'link_name']
+ exclude = ['inheritance_line', 'home', 'partial_path', 'link_id']
partial_path = forms.CharField(widget=forms.HiddenInput)
- link_name = forms.CharField(widget=forms.HiddenInput)
+ link_id = forms.CharField(widget=forms.HiddenInput)
class EditForm(CreateForm):
--- a/app/soc/views/models/sponsor.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/sponsor.py Thu Nov 20 18:50:30 2008 +0000
@@ -55,27 +55,27 @@
exclude = ['founder', 'inheritance_line']
# TODO(pawel.solyga): write validation functions for other fields
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
- if models.sponsor.logic.getFromFields(link_name=link_name):
- raise forms.ValidationError("This link name is already in use.")
- return link_name
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
+ if models.sponsor.logic.getFromFields(link_id=link_id):
+ raise forms.ValidationError("This link ID is already in use.")
+ return link_id
class EditForm(CreateForm):
"""Django form displayed when editing a Sponsor.
"""
- link_name = forms.CharField(widget=helper.widgets.ReadOnlyInput())
+ link_id = forms.CharField(widget=helper.widgets.ReadOnlyInput())
founded_by = forms.CharField(widget=helper.widgets.ReadOnlyInput(),
required=False)
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
- return link_name
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
+ return link_id
class View(base.View):
--- a/app/soc/views/models/user.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/models/user.py Thu Nov 20 18:50:30 2008 +0000
@@ -47,9 +47,9 @@
label=soc.models.user.User.account.verbose_name,
help_text=soc.models.user.User.account.help_text)
- link_name = forms.CharField(
- label=soc.models.user.User.link_name.verbose_name,
- help_text=soc.models.user.User.link_name.help_text)
+ link_id = forms.CharField(
+ label=soc.models.user.User.link_id.verbose_name,
+ help_text=soc.models.user.User.link_id.help_text)
nick_name = forms.CharField(
label=soc.models.user.User.nick_name.verbose_name)
@@ -61,25 +61,25 @@
class Meta:
model = None
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
- properties = {'link_name': link_name}
+ properties = {'link_id': link_id}
user = soc.logic.models.user.logic.getForFields(properties, unique=True)
- link_name_user = soc.logic.models.user.logic.getForFields(properties, unique=True)
+ link_id_user = soc.logic.models.user.logic.getForFields(properties, unique=True)
key_name = self.data.get('key_name')
if key_name:
key_name_user = user_logic.logic.getFromKeyName(key_name)
- if link_name_user and key_name_user and \
- link_name_user.account != key_name_user.account:
- raise forms.ValidationError("This link name is already in use.")
+ if link_id_user and key_name_user and \
+ link_id_user.account != key_name_user.account:
+ raise forms.ValidationError("This link ID is already in use.")
- return link_name
+ return link_id
def clean_email(self):
form_account = users.User(email=self.cleaned_data.get('email'))
--- a/app/soc/views/person/profile.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/person/profile.py Thu Nov 20 18:50:30 2008 +0000
@@ -55,7 +55,7 @@
@decorators.view
-def edit(request, page_name=None, program=None, link_name=None,
+def edit(request, page_name=None, program=None, link_id=None,
template='soc/person/profile/edit.html'):
"""View for a Person to modify the properties of a Person Model.
@@ -77,7 +77,7 @@
# query for the human-readable program name and pass that to the form
# TODO(tlarsen)
- # if link_name:
+ # if link_id:
# query for a site-wide user profile for a friendly display name
# to use in the greeting
# else:
@@ -93,4 +93,4 @@
return shortcuts.render_to_response(
template, dictionary={'template': template, 'form': form, 'user': user,
- 'program': program, 'link_name': link_name})
\ No newline at end of file
+ 'program': program, 'link_id': link_id})
\ No newline at end of file
--- a/app/soc/views/settings.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/settings.py Thu Nov 20 18:50:30 2008 +0000
@@ -94,9 +94,9 @@
# TODO(tlarsen): actually, using these two text fields to specify
# the Document is pretty cheesy; this needs to be some much better
# Role-scoped Document selector that we don't have yet
- doc_link_name = forms.CharField(required=False,
- label=soc.models.work.Work.link_name.verbose_name,
- help_text=soc.models.work.Work.link_name.help_text)
+ doc_link_id = forms.CharField(required=False,
+ label=soc.models.work.Work.link_id.verbose_name,
+ help_text=soc.models.work.Work.link_id.help_text)
class Meta:
model = None
@@ -105,7 +105,7 @@
DEF_HOME_EDIT_TMPL = 'soc/site_settings/edit.html'
@decorators.view
-def edit(request, page_name=None, partial_path=None, link_name=None,
+def edit(request, page_name=None, partial_path=None, link_id=None,
logic=models.home_settings.logic,
settings_form_class=SettingsForm,
template=DEF_HOME_EDIT_TMPL):
@@ -151,10 +151,10 @@
fields[field] = value
doc_partial_path = doc_select_form.cleaned_data.get('doc_partial_path')
- doc_link_name = doc_select_form.cleaned_data.get('doc_link_name')
+ doc_link_id = doc_select_form.cleaned_data.get('doc_link_id')
home_doc = document.logic.getFromFields(
- partial_path=doc_partial_path, link_name=doc_link_name)
+ partial_path=doc_partial_path, link_id=doc_link_id)
if home_doc:
fields['home'] = home_doc
@@ -172,7 +172,7 @@
else: # request.method == 'GET'
# try to fetch HomeSettings entity by unique key_name
settings = logic.getFromFields(partial_path=partial_path,
- link_name=link_name)
+ link_id=link_id)
if settings:
# populate form with the existing HomeSettings entity
@@ -187,7 +187,7 @@
if home_doc:
doc_select_form = DocSelectForm(initial={
'doc_partial_path': home_doc.partial_path,
- 'doc_link_name': home_doc.link_name})
+ 'doc_link_id': home_doc.link_id})
else:
doc_select_form = DocSelectForm()
else:
--- a/app/soc/views/simple.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/simple.py Thu Nov 20 18:50:30 2008 +0000
@@ -37,20 +37,20 @@
DEF_PUBLIC_TMPL = 'soc/base.html'
@decorators.view
-def public(request, page_name=None, template=DEF_PUBLIC_TMPL, link_name=None,
+def public(request, page_name=None, template=DEF_PUBLIC_TMPL, link_id=None,
context=None):
- """A simple template view that expects a link_name extracted from the URL.
+ """A simple template view that expects a link_id extracted from the URL.
Args:
request: the standard Django HTTP request object
page_name: the page name displayed in templates as page and header title
template: the template to use for rendering the view (or a search list
of templates)
- link_name: a site-unique "link_name" (usually extracted from the URL)
+ link_id: a site-unique "link_id" (usually extracted from the URL)
context: the context dict supplied to the template, which is modified
(so supply a copy if such modification is not acceptable)
- link_name: the link_name parameter is added to the context
- link_name_user: if the link_name exists for a User, that User
+ link_id: the link_id parameter is added to the context
+ link_id_user: if the link_id exists for a User, that User
is added to the context
@@ -69,13 +69,13 @@
context['page_name'] = page_name
try:
- if link_name:
- user = accounts.getUserFromLinkNameOr404(link_name)
+ if link_id:
+ user = accounts.getUserFromLinkIdOr404(link_id)
except out_of_band.ErrorResponse, error:
return errorResponse(request, page_name, error, template, context)
- context['link_name'] = link_name
- context['link_name_user'] = user
+ context['link_id'] = link_id
+ context['link_id_user'] = user
return helper.responses.respond(request, template, context)
--- a/app/soc/views/site/settings.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/site/settings.py Thu Nov 20 18:50:30 2008 +0000
@@ -47,7 +47,7 @@
@decorators.view
-def edit(request, page_name=None, partial_path=None, link_name=None,
+def edit(request, page_name=None, partial_path=None, link_id=None,
logic=models.site_settings.logic,
settings_form_class=SiteSettingsForm,
template=settings_views.DEF_HOME_EDIT_TMPL):
@@ -65,7 +65,7 @@
A subclass of django.http.HttpResponse with generated template.
"""
return settings_views.edit(request, page_name=page_name, partial_path=partial_path,
- link_name=link_name, logic=logic,
+ link_id=link_id, logic=logic,
settings_form_class=settings_form_class,
template=template)
\ No newline at end of file
--- a/app/soc/views/site/sponsor/profile.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/site/sponsor/profile.py Thu Nov 20 18:50:30 2008 +0000
@@ -59,44 +59,44 @@
exclude = ['founder', 'inheritance_line']
# TODO(pawel.solyga): write validation functions for other fields
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
- if models.sponsor.logic.getFromFields(link_name=link_name):
- raise forms.ValidationError("This link name is already in use.")
- return link_name
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
+ if models.sponsor.logic.getFromFields(link_id=link_id):
+ raise forms.ValidationError("This link ID is already in use.")
+ return link_id
class EditForm(CreateForm):
"""Django form displayed when editing a Sponsor.
"""
- link_name = forms.CharField(widget=helper.widgets.ReadOnlyInput())
+ link_id = forms.CharField(widget=helper.widgets.ReadOnlyInput())
founded_by = forms.CharField(widget=helper.widgets.ReadOnlyInput(),
required=False)
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
- return link_name
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
+ return link_id
DEF_SITE_SPONSOR_PROFILE_EDIT_TMPL = 'soc/site/sponsor/profile/edit.html'
-DEF_SPONSOR_NO_LINKNAME_CHANGE_MSG = 'Sponsor link name cannot be changed.'
+DEF_SPONSOR_NO_LINK_ID_CHANGE_MSG = 'Sponsor link ID cannot be changed.'
DEF_CREATE_NEW_SPONSOR_MSG = ' You can create a new sponsor by visiting' \
' <a href="/site/sponsor/profile">Create ' \
'a New Sponsor</a> page.'
@decorators.view
-def edit(request, page_name=None, link_name=None,
+def edit(request, page_name=None, link_id=None,
template=DEF_SITE_SPONSOR_PROFILE_EDIT_TMPL):
"""View for a Developer to modify the properties of a Sponsor Model entity.
Args:
request: the standard django request object
page_name: the page name displayed in templates as page and header title
- link_name: the Sponsor's site-unique "link_name" extracted from the URL
+ link_id: the Sponsor's site-unique "link_id" extracted from the URL
template: the "sibling" template (or a search list of such templates)
from which to construct the public.html template name (or names)
@@ -119,11 +119,11 @@
sponsor_form = None
existing_sponsor = None
- # try to fetch Sponsor entity corresponding to link_name if one exists
+ # try to fetch Sponsor entity corresponding to link_id if one exists
try:
- existing_sponsor = sponsor.logic.getIfFields(link_name=link_name)
+ existing_sponsor = sponsor.logic.getIfFields(link_id=link_id)
except out_of_band.ErrorResponse, error:
- # show custom 404 page when link name doesn't exist in Datastore
+ # show custom 404 page when link ID doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_SPONSOR_MSG
return simple.errorResponse(request, page_name, error, template, context)
@@ -134,12 +134,12 @@
sponsor_form = CreateForm(request.POST)
if sponsor_form.is_valid():
- if link_name:
- # Form doesn't allow to change link_name but somebody might want to
- # abuse that manually, so we check if form link_name is the same as
- # url link_name
- if sponsor_form.cleaned_data.get('link_name') != link_name:
- msg = DEF_SPONSOR_NO_LINKNAME_CHANGE_MSG
+ if link_id:
+ # Form doesn't allow to change link_id but somebody might want to
+ # abuse that manually, so we check if form link_id is the same as
+ # url link_id
+ if sponsor_form.cleaned_data.get('link_id') != link_id:
+ msg = DEF_SPONSOR_NO_LINK_ID_CHANGE_MSG
error = out_of_band.ErrorResponse(msg)
return simple.errorResponse(request, page_name, error, template, context)
@@ -153,7 +153,7 @@
if not existing_sponsor:
fields['founder'] = user
- form_ln = fields['link_name']
+ form_ln = fields['link_id']
key_fields = models.sponsor.logic.getKeyFieldsFromKwargs(fields)
form_sponsor = models.sponsor.logic.updateOrCreateFromFields(
fields, key_fields)
@@ -161,7 +161,7 @@
if not form_sponsor:
return http.HttpResponseRedirect('/')
- # redirect to new /site/sponsor/profile/form_link_name?s=0
+ # redirect to new /site/sponsor/profile/form_link_id?s=0
# (causes 'Profile saved' message to be displayed)
return helper.responses.redirectToChangedSuffix(
request, None, form_ln,
@@ -172,7 +172,7 @@
# is 'Profile saved' parameter present, but referrer was not ourself?
# (e.g. someone bookmarked the GET that followed the POST submit)
if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
- and (not helper.requests.isReferrerSelf(request, suffix=link_name))):
+ and (not helper.requests.isReferrerSelf(request, suffix=link_id))):
# redirect to aggressively remove 'Profile saved' query parameter
return http.HttpResponseRedirect(request.path)
@@ -184,15 +184,15 @@
values=profile.SUBMIT_MESSAGES))
# populate form with the existing Sponsor entity
- founder_link_name = existing_sponsor.founder.link_name
+ founder_link_id = existing_sponsor.founder.link_id
sponsor_form = EditForm(instance=existing_sponsor,
- initial={'founded_by': founder_link_name})
+ initial={'founded_by': founder_link_id})
else:
if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME):
# redirect to aggressively remove 'Profile saved' query parameter
return http.HttpResponseRedirect(request.path)
- # no Sponsor entity exists for this link name, so show a blank form
+ # no Sponsor entity exists for this link ID, so show a blank form
sponsor_form = CreateForm()
context.update({'form': sponsor_form,
@@ -207,20 +207,20 @@
@decorators.view
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.
+ """create() view is same as edit() view, but with no link_id supplied.
"""
- return edit(request, page_name=page_name, link_name=None, template=template)
+ return edit(request, page_name=page_name, link_id=None, template=template)
@decorators.view
-def delete(request, page_name=None, link_name=None,
+def delete(request, page_name=None, link_id=None,
template=DEF_SITE_SPONSOR_PROFILE_EDIT_TMPL):
"""Request handler for a Developer to delete Sponsor Model entity.
Args:
request: the standard django request object
page_name: the page name displayed in templates as page and header title
- link_name: the Sponsor's site-unique "link_name" extracted from the URL
+ link_id: the Sponsor's site-unique "link_id" extracted from the URL
template: the "sibling" template (or a search list of such templates)
from which to construct the public.html template name (or names)
@@ -240,11 +240,11 @@
existing_sponsor = None
- # try to fetch Sponsor entity corresponding to link_name if one exists
+ # try to fetch Sponsor entity corresponding to link_id if one exists
try:
- existing_sponsor = models.sponsor.logic.getIfFields(link_name=link_name)
+ existing_sponsor = models.sponsor.logic.getIfFields(link_id=link_id)
except out_of_band.ErrorResponse, error:
- # show custom 404 page when link name doesn't exist in Datastore
+ # show custom 404 page when link ID doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_SPONSOR_MSG
return simple.errorResponse(request, page_name, error, template, context)
--- a/app/soc/views/site/user/profile.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/site/user/profile.py Thu Nov 20 18:50:30 2008 +0000
@@ -61,24 +61,24 @@
label=soc.models.user.User.account.verbose_name,
help_text=soc.models.user.User.account.help_text)
- link_name = forms.CharField(required=False,
- label=soc.models.user.User.link_name.verbose_name,
- help_text=soc.models.user.User.link_name.help_text)
+ link_id = forms.CharField(required=False,
+ label=soc.models.user.User.link_id.verbose_name,
+ help_text=soc.models.user.User.link_id.help_text)
class Meta:
model = None
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
- if not link_name:
- # link name not supplied (which is OK), so do not try to validate it
+ if not link_id:
+ # link ID not supplied (which is OK), so do not try to validate it
return None
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError('This link name is in wrong format.')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError('This link ID is in wrong format.')
- return link_name
+ return link_id
def clean_account(self):
email = self.cleaned_data.get('account')
@@ -149,28 +149,28 @@
context['lookup_link'] = './list?offset=%s&limit=%s' % (
nearest_user_range_start, range_width)
if not user:
- # user not found yet, so see if link name was provided
- link_name = form.cleaned_data.get('link_name')
+ # user not found yet, so see if link ID was provided
+ link_id = form.cleaned_data.get('link_id')
- if link_name:
- # link name provided, so try to look up by link name
- user = models.user.logic.getForFields({'link_name': link_name},
+ if link_id:
+ # link ID provided, so try to look up by link ID
+ user = models.user.logic.getForFields({'link_id': link_id},
unique=True)
if user:
- lookup_message = ugettext_lazy('User found by link name.')
+ lookup_message = ugettext_lazy('User found by link ID.')
# clear previous error, since User was found
email_error = None
# clear previous lookup_link, since User was found, the lookup_link
# is not needed to display.
context['lookup_link'] = None
else:
- context['link_name_error'] = ugettext_lazy(
- 'User with that link name not found.')
+ context['link_id_error'] = ugettext_lazy(
+ 'User with that link ID not found.')
if context['lookup_link'] is None:
range_width = helper.lists.getPreferredListPagination()
nearest_user_range_start = (
models.user.logic.findNearestEntitiesOffset(
- width, [('link_name', link_name)]))
+ width, [('link_id', link_id)]))
if nearest_user_range_start is not None:
context['lookup_link'] = './list?offset=%s&limit=%s' % (
@@ -182,12 +182,12 @@
# User entity found, so populate form with existing User information
# context['found_user'] = user
form = LookupForm(initial={'account': user.account.email(),
- 'link_name': user.link_name})
+ 'link_id': user.link_id})
if request.path.endswith('lookup'):
- # convert /lookup path into /profile/link_name path
+ # convert /lookup path into /profile/link_id path
context['edit_link'] = helper.requests.replaceSuffix(
- request.path, 'lookup', 'profile/%s' % user.link_name)
+ request.path, 'lookup', 'profile/%s' % user.link_id)
# else: URL is not one that was expected, so do not display edit link
elif not form:
# no pre-populated form was constructed, so show the empty look-up form
@@ -213,9 +213,9 @@
label=soc.models.user.User.account.verbose_name,
help_text=soc.models.user.User.account.help_text)
- link_name = forms.CharField(
- label=soc.models.user.User.link_name.verbose_name,
- help_text=soc.models.user.User.link_name.help_text)
+ link_id = forms.CharField(
+ label=soc.models.user.User.link_id.verbose_name,
+ help_text=soc.models.user.User.link_id.help_text)
nick_name = forms.CharField(
label=soc.models.user.User.nick_name.verbose_name)
@@ -229,20 +229,20 @@
class Meta:
model = None
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
key_name = self.data.get('key_name')
if key_name:
key_name_user = user_logic.logic.getFromKeyName(key_name)
- if link_name_user and key_name_user and \
- link_name_user.account != key_name_user.account:
- raise forms.ValidationError("This link name is already in use.")
+ if link_id_user and key_name_user and \
+ link_id_user.account != key_name_user.account:
+ raise forms.ValidationError("This link ID is already in use.")
- return link_name
+ return link_id
def clean_account(self):
form_account = users.User(email=self.cleaned_data.get('account'))
@@ -261,14 +261,14 @@
'a New User</a> page.'
@decorators.view
-def edit(request, page_name=None, link_name=None,
+def edit(request, page_name=None, link_id=None,
template=DEF_SITE_USER_PROFILE_EDIT_TMPL):
"""View for a Developer to modify the properties of a User Model entity.
Args:
request: the standard django request object
page_name: the page name displayed in templates as page and header title
- link_name: the User's site-unique "link_name" extracted from the URL
+ link_id: the User's site-unique "link_id" extracted from the URL
template: the "sibling" template (or a search list of such templates)
from which to construct the public.html template name (or names)
@@ -288,12 +288,12 @@
user = None # assume that no User entity will be found
- # try to fetch User entity corresponding to link_name if one exists
+ # try to fetch User entity corresponding to link_id if one exists
try:
- if link_name:
- user = accounts.getUserFromLinkNameOr404(link_name)
+ if link_id:
+ user = accounts.getUserFromLinkIdOr404(link_id)
except out_of_band.ErrorResponse, error:
- # show custom 404 page when link name doesn't exist in Datastore
+ # show custom 404 page when link ID doesn't exist in Datastore
error.message = error.message + DEF_CREATE_NEW_USER_MSG
return simple.errorResponse(request, page_name, error, template, context)
@@ -303,11 +303,11 @@
if form.is_valid():
key_name = form.cleaned_data.get('key_name')
- new_link_name = form.cleaned_data.get('link_name')
+ new_link_id = form.cleaned_data.get('link_id')
properties = {}
properties['account'] = form.cleaned_data.get('account')
- properties['link_name'] = new_link_name
+ properties['link_id'] = new_link_id
properties['nick_name'] = form.cleaned_data.get('nick_name')
properties['is_developer'] = form.cleaned_data.get('is_developer')
@@ -316,20 +316,20 @@
if not user:
return http.HttpResponseRedirect('/')
- # redirect to new /site/user/profile/new_link_name?s=0
+ # redirect to new /site/user/profile/new_link_id?s=0
# (causes 'Profile saved' message to be displayed)
return helper.responses.redirectToChangedSuffix(
- request, link_name, new_link_name,
+ request, link_id, new_link_id,
params=profile.SUBMIT_PROFILE_SAVED_PARAMS)
else: # method == 'GET':
- # try to fetch User entity corresponding to link name if one exists
- if link_name:
+ # try to fetch User entity corresponding to link ID if one exists
+ if link_id:
if user:
# is 'Profile saved' parameter present, but referrer was not ourself?
# (e.g. someone bookmarked the GET that followed the POST submit)
if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
and (not helper.requests.isReferrerSelf(request,
- suffix=link_name))):
+ suffix=link_id))):
# redirect to aggressively remove 'Profile saved' query parameter
return http.HttpResponseRedirect(request.path)
@@ -342,7 +342,7 @@
# populate form with the existing User entity
form = EditForm(initial={'key_name': user.key().name(),
- 'account': user.account.email(), 'link_name': user.link_name,
+ 'account': user.account.email(), 'link_id': user.link_id,
'nick_name': user.nick_name, 'is_developer': user.is_developer})
else:
if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME):
@@ -350,14 +350,14 @@
return http.HttpResponseRedirect(request.path)
context['lookup_error'] = ugettext_lazy(
- 'User with that link name not found.')
- form = EditForm(initial={'link_name': link_name})
- else: # no link name specified in the URL
+ 'User with that link ID not found.')
+ form = EditForm(initial={'link_id': link_id})
+ else: # no link ID specified in the URL
if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME):
# redirect to aggressively remove 'Profile saved' query parameter
return http.HttpResponseRedirect(request.path)
- # no link name specified, so start with an empty form
+ # no link ID specified, so start with an empty form
form = EditForm()
context.update({'form': form,
@@ -378,9 +378,9 @@
label=soc.models.user.User.account.verbose_name,
help_text=soc.models.user.User.account.help_text)
- link_name = forms.CharField(
- label=soc.models.user.User.link_name.verbose_name,
- help_text=soc.models.user.User.link_name.help_text)
+ link_id = forms.CharField(
+ label=soc.models.user.User.link_id.verbose_name,
+ help_text=soc.models.user.User.link_id.help_text)
nick_name = forms.CharField(
label=soc.models.user.User.nick_name.verbose_name)
@@ -392,15 +392,15 @@
class Meta:
model = None
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
else:
- if models.user.logic.getForFields({'link_name': link_name},
+ if models.user.logic.getForFields({'link_id': link_id},
unique=True):
- raise forms.ValidationError("This link name is already in use.")
- return link_name
+ raise forms.ValidationError("This link ID is already in use.")
+ return link_id
def clean_account(self):
new_email = self.cleaned_data.get('account')
@@ -444,11 +444,11 @@
if form.is_valid():
form_account = form.cleaned_data.get('account')
- link_name = form.cleaned_data.get('link_name')
+ link_id = form.cleaned_data.get('link_id')
properties = {
'account': form_account,
- 'link_name': link_name,
+ 'link_id': link_id,
'nick_name': form.cleaned_data.get('nick_name'),
'is_developer': form.cleaned_data.get('is_developer'),
}
@@ -460,13 +460,13 @@
if not user:
return http.HttpResponseRedirect('/')
- # redirect to new /site/user/profile/new_link_name?s=0
+ # redirect to new /site/user/profile/new_link_id?s=0
# (causes 'Profile saved' message to be displayed)
return helper.responses.redirectToChangedSuffix(
- request, 'create', 'edit/' + link_name,
+ request, 'create', 'edit/' + link_id,
params=profile.SUBMIT_PROFILE_SAVED_PARAMS)
else: # method == 'GET':
- # no link name specified, so start with an empty form
+ # no link ID specified, so start with an empty form
form = CreateForm()
context['form'] = form
--- a/app/soc/views/sponsor/profile.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/sponsor/profile.py Thu Nov 20 18:50:30 2008 +0000
@@ -36,14 +36,14 @@
DEF_SPONSOR_PUBLIC_TMPL = 'soc/group/profile/public.html'
@decorators.view
-def public(request, page_name=None, link_name=None,
+def public(request, page_name=None, link_id=None,
template=DEF_SPONSOR_PUBLIC_TMPL):
"""How the "general public" sees the Sponsor profile.
Args:
request: the standard django request object.
page_name: the page name displayed in templates as page and header title
- link_name: the Sponsor's site-unique "link_name" extracted from the URL
+ link_id: the Sponsor's site-unique "link_id" extracted from the URL
template: the template path to use for rendering the template
Returns:
@@ -54,16 +54,16 @@
context['page_name'] = page_name
try:
- link_name_sponsor = soc.logic.models.sponsor.logic.getIfFields(
- link_name=link_name)
+ link_id_sponsor = soc.logic.models.sponsor.logic.getIfFields(
+ link_id=link_id)
except out_of_band.ErrorResponse, error:
- # show custom 404 page when link name doesn't exist in Datastore
+ # show custom 404 page when link ID doesn't exist in Datastore
return simple.errorResponse(request, page_name, error, template, context)
- link_name_sponsor.description = \
- helper.templates.unescape(link_name_sponsor.description)
+ link_id_sponsor.description = \
+ helper.templates.unescape(link_id_sponsor.description)
- context.update({'entity': link_name_sponsor,
+ context.update({'entity': link_id_sponsor,
'entity_type': sponsor_model.Sponsor.TYPE_NAME})
return helper.responses.respond(request, template, context)
\ No newline at end of file
--- a/app/soc/views/user/profile.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/user/profile.py Thu Nov 20 18:50:30 2008 +0000
@@ -55,12 +55,12 @@
#: list of model fields which will *not* be gathered by the form
exclude = ['account', 'former_accounts', 'is_developer']
- def clean_link_name(self):
- link_name = self.cleaned_data.get('link_name')
- if not validate.isLinkNameFormatValid(link_name):
- raise forms.ValidationError("This link name is in wrong format.")
+ def clean_link_id(self):
+ link_id = self.cleaned_data.get('link_id')
+ if not validate.isLinkIdFormatValid(link_id):
+ raise forms.ValidationError("This link ID is in wrong format.")
- user = models.user.logic.getForFields({'link_name': link_name},
+ user = models.user.logic.getForFields({'link_id': link_id},
unique=True)
# Get the currently logged in user account
@@ -68,9 +68,9 @@
if user:
if current_account != user.account:
- raise forms.ValidationError("This link name is already in use.")
+ raise forms.ValidationError("This link ID is already in use.")
- return link_name
+ return link_id
DEF_USER_PROFILE_EDIT_TMPL = 'soc/user/edit_self.html'
@@ -89,14 +89,14 @@
}
@decorators.view
-def edit(request, page_name=None, link_name=None,
+def edit(request, page_name=None, link_id=None,
template=DEF_USER_PROFILE_EDIT_TMPL):
"""View for a User to modify the properties of a User Model entity.
Args:
request: the standard django request object
page_name: the page name displayed in templates as page and header title
- link_name: the User's site-unique "link_name" extracted from the URL
+ link_id: the User's site-unique "link_id" extracted from the URL
template: the template path to use for rendering the template
Returns:
@@ -108,8 +108,8 @@
# create default template context for use with any templates
context = helper.responses.getUniversalContext(request)
- if (not account) and (not link_name):
- # not logged in, and no link name, so request that the user sign in
+ if (not account) and (not link_id):
+ # not logged in, and no link ID, so request that the user sign in
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(
@@ -117,35 +117,35 @@
' or modify an existing one, you must first'
' <a href="%(sign_in)s">sign in</a>.'))
- if (not account) and link_name:
- # not logged in, so show read-only public profile for link_name user
+ if (not account) and link_id:
+ # not logged in, so show read-only public profile for link_id user
return simple.public(request, page_name=page_name, template=template,
- link_name=link_name, context=context)
+ link_id=link_id, context=context)
- link_name_user = None
+ link_id_user = None
- # try to fetch User entity corresponding to link_name if one exists
+ # try to fetch User entity corresponding to link_id if one exists
try:
- if link_name:
- link_name_user = accounts.getUserFromLinkNameOr404(link_name)
+ if link_id:
+ link_id_user = accounts.getUserFromLinkIdOr404(link_id)
except out_of_band.ErrorResponse, error:
- # show custom 404 page when link name doesn't exist in Datastore
+ # show custom 404 page when link ID doesn't exist in Datastore
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,
+ # link_id_user will be None here if link ID was already None...
+ if link_id_user and (link_id_user.account != account):
+ # link_id_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_name=page_name, template=template,
- link_name=link_name, context=context)
+ link_id=link_id, context=context)
if request.method == 'POST':
form = UserForm(request.POST)
if form.is_valid():
- new_link_name = form.cleaned_data.get('link_name')
+ new_link_id = form.cleaned_data.get('link_id')
properties = {
- 'link_name': new_link_name,
+ 'link_id': new_link_id,
'nick_name': form.cleaned_data.get("nick_name"),
'account': account,
}
@@ -157,7 +157,7 @@
error = out_of_band.ErrorResponse(msg)
return simple.errorResponse(request, page_name, error, template, context)
- user = models.user.logic.updateOrCreateFromFields(properties, {'link_name': new_link_name})
+ user = models.user.logic.updateOrCreateFromFields(properties, {'link_id': new_link_id})
# redirect to /user/profile?s=0
# (causes 'Profile saved' message to be displayed)
@@ -172,7 +172,7 @@
# (e.g. someone bookmarked the GET that followed the POST submit)
if (request.GET.get(SUBMIT_MSG_PARAM_NAME)
and (not helper.requests.isReferrerSelf(request,
- suffix=link_name))):
+ suffix=link_id))):
# redirect to aggressively remove 'Profile saved' query parameter
return http.HttpResponseRedirect(request.path)
@@ -198,6 +198,6 @@
@decorators.view
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.
+ """create() view is same as edit() view, but with no link_id supplied.
"""
- return edit(request, page_name=page_name, link_name=None, template=template)
\ No newline at end of file
+ return edit(request, page_name=page_name, link_id=None, template=template)
\ No newline at end of file
--- a/app/soc/views/user/roles.py Thu Nov 20 18:06:43 2008 +0000
+++ b/app/soc/views/user/roles.py Thu Nov 20 18:50:30 2008 +0000
@@ -31,14 +31,14 @@
@decorators.view
-def dashboard(request, page_name=None, link_name=None,
+def dashboard(request, page_name=None, link_id=None,
template='soc/user/roles/dashboard.html'):
"""A per-User dashboard of that User's Roles on the site.
Args:
request: the standard django request object
page_name: the page name displayed in templates as page and header title
- link_name: the User's site-unique "link_name" extracted from the URL
+ link_id: the User's site-unique "link_id" extracted from the URL
template: the template path to use for rendering the template
Returns:
@@ -46,7 +46,7 @@
"""
#TODO(tlarsen): this module is currently a placeholder for future work
- # TODO: check that user is logged in and "owns" the link_name;
+ # TODO: check that user is logged in and "owns" the link_id;
# if not, call public() view instead
# This might be tricky, since we want to use the same style
# of template that was passed to us, but how do we figure out
@@ -60,14 +60,14 @@
@decorators.view
-def public(request, page_name=None, link_name=None,
+def public(request, page_name=None, link_id=None,
template='soc/user/roles/public.html'):
"""A "general public" view of a User's Roles on the site.
Args:
request: the standard django request object
page_name: the page name displayed in templates as page and header title
- link_name: the User's site-unique "link_name" extracted from the URL
+ link_id: the User's site-unique "link_id" extracted from the URL
template: the template path to use for rendering the template
Returns:
@@ -75,7 +75,7 @@
"""
#TODO(tlarsen): this module is currently a placeholder for future work
- # TODO: if link_name is empty or not a valid link_name on the site, display
+ # TODO: if link_id is empty or not a valid link_id on the site, display
# some sort of "user does not exist" page (a custom 404 page, maybe?).
return responses.respond(request,