app/soc/logic/site/map.py
changeset 403 d3e545a8bd26
parent 401 37d0b6c25f3e
child 404 44223e50e1fc
equal deleted inserted replaced
402:021e86368600 403:d3e545a8bd26
   161   page.Url(
   161   page.Url(
   162     r'^docs/show/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
   162     r'^docs/show/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
   163     'soc.views.models.docs.public'),
   163     'soc.views.models.docs.public'),
   164   'Show Document',
   164   'Show Document',
   165   parent=home)
   165   parent=home)
   166  
   166 
   167 # Site Document views
   167 # Site Document views
   168 site_docs_sub_menu = page.NonPage(
   168 site_docs_sub_menu = page.NonPage(
   169   'site-docs-sub-menu',
   169   'site-docs-sub-menu',
   170   'Site: Documents Sub-Menu',
   170   'Site: Documents Sub-Menu',
   171   short_name='Site Documents',
   171   short_name='Site Documents',
   208   page.Url(
   208   page.Url(
   209     r'^sponsor/profile/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
   209     r'^sponsor/profile/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
   210     'soc.views.models.sponsor.public'),
   210     'soc.views.models.sponsor.public'),
   211   'Sponsor Public Profile',
   211   'Sponsor Public Profile',
   212   parent=home)
   212   parent=home)
   213     
   213 
   214 # Sponsor Group Site views
   214 # Sponsor Group Site views
   215 site_sponsor_sub_menu = page.NonPage(
   215 site_sponsor_sub_menu = page.NonPage(
   216   'site-sponsor-sub-menu',
   216   'site-sponsor-sub-menu',
   217   'Site: Sponsors Sub-Menu',
   217   'Site: Sponsors Sub-Menu',
   218   short_name='Site Sponsors',
   218   short_name='Site Sponsors',
   256 #     'soc.views.person.profile.edit',
   256 #     'soc.views.person.profile.edit',
   257 #     {'template': 'ghop/person/profile/edit.html'}),
   257 #     {'template': 'ghop/person/profile/edit.html'}),
   258 #    (r'^org/profile/(?P<program>[_0-9a-z]+)/(?P<link_name>[_0-9a-z]+)/$',
   258 #    (r'^org/profile/(?P<program>[_0-9a-z]+)/(?P<link_name>[_0-9a-z]+)/$',
   259 #     'soc.views.person.profile.edit'),
   259 #     'soc.views.person.profile.edit'),
   260 
   260 
   261     
   261 
   262 ROOT_PAGES = [
   262 ROOT_PAGES = [
   263   # /, first level of the sidebar menu, excluded from breadcrumbs
   263   # /, first level of the sidebar menu, excluded from breadcrumbs
   264   home,
   264   home,
   265   
   265 
   266   # alternate view of /, no menu presence
   266   # alternate view of /, no menu presence
   267   site_home,
   267   site_home,
   268 ]
   268 ]
   269 
   269 
   270 
   270 
   271 def getDjangoUrlPatterns(pages=ROOT_PAGES):
   271 def getDjangoUrlPatterns(pages=ROOT_PAGES):
   272   """Returns Django urlpatterns derived from the site map Pages.
   272   """Returns Django urlpatterns derived from the site map Pages.
   273   
   273 
   274   Args:
   274   Args:
   275     pages: a list of page.Page objects from which to generate urlpatterns
   275     pages: a list of page.Page objects from which to generate urlpatterns
   276       (from them and from their child Pages); default is ROOT_PAGES
   276       (from them and from their child Pages); default is ROOT_PAGES
   277 
   277 
   278   Raises:
   278   Raises:
   279     KeyError if more than one Page has the same urlpattern.
   279     KeyError if more than one Page has the same urlpattern.
   280     
   280 
   281     TODO(tlarsen): this probably does not work correctly, currently, since
   281     TODO(tlarsen): this probably does not work correctly, currently, since
   282     page.Page.makeDjangoUrls() returns a list, and this routine is
   282     page.Page.makeDjangoUrls() returns a list, and this routine is
   283     combining lists from potentially multiple page hierarchies.  Each list
   283     combining lists from potentially multiple page hierarchies.  Each list
   284     might have a urlpattern that the other contains, but this won't be
   284     might have a urlpattern that the other contains, but this won't be
   285     detected by the current code (will Django catch this?).  This really
   285     detected by the current code (will Django catch this?).  This really
   286     needs to be detected earlier via a global Page dictionary.
   286     needs to be detected earlier via a global Page dictionary.
   287   """
   287   """
   288   urlpatterns = ['']
   288   urlpatterns = ['']
   289   
   289 
   290   for page in pages:
   290   for page in pages:
   291     urlpatterns.extend(page.makeDjangoUrls())
   291     urlpatterns.extend(page.makeDjangoUrls())
   292 
   292 
   293   return defaults.patterns(*urlpatterns)
   293   return defaults.patterns(*urlpatterns)