app/soc/views/models/site.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 22 Jan 2009 16:04:48 +0000
changeset 901 d580a057103d
parent 858 e79e7a22326f
child 903 7110fc489fd0
permissions -rw-r--r--
Presence is now a 'abstract' View, pull in members from program This is signified by the removal of params['name'] and other values that are required by params.py, but also by the removal of the 'view' definition at the bottom of the file. Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""Views for Site Settings.
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
    '"Sverre Rabbelier" <sverre@rabbelier.nl>',
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
  ]
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from django import forms
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
from soc.logic import dicts
551
2ee7ad5266a8 Define a default for rights['public'] in views/models/base.py. Alter rights
Todd Larsen <tlarsen@google.com>
parents: 544
diff changeset
    28
from soc.views.helper import access
706
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    29
from soc.views.models import document as document_view
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 513
diff changeset
    30
from soc.views.models import presence
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 513
diff changeset
    32
import soc.models.site
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 513
diff changeset
    33
import soc.logic.models.site
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
import soc.logic.dicts
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 513
diff changeset
    37
class View(presence.View):
499
d22e4fe8e64b Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 494
diff changeset
    38
  """View methods for the Document model.
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
  """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    41
  def __init__(self, params=None):
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
    """Defines the fields and methods required for the base View class
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
    to provide the user with list, public, create, edit and delete views.
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
    Params:
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    46
      params: a dict with params for this View
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
    """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
708
89f1a8c2ea59 Some cleanups in role.py and site.py and create()
Sverre Rabbelier <srabbelier@gmail.com>
parents: 706
diff changeset
    49
    rights = {}
89f1a8c2ea59 Some cleanups in role.py and site.py and create()
Sverre Rabbelier <srabbelier@gmail.com>
parents: 706
diff changeset
    50
    rights['unspecified'] = [access.checkIsDeveloper]
89f1a8c2ea59 Some cleanups in role.py and site.py and create()
Sverre Rabbelier <srabbelier@gmail.com>
parents: 706
diff changeset
    51
    rights['any_access'] = [access.allow]
710
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 708
diff changeset
    52
    rights['show'] = [access.allow]
708
89f1a8c2ea59 Some cleanups in role.py and site.py and create()
Sverre Rabbelier <srabbelier@gmail.com>
parents: 706
diff changeset
    53
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    54
    new_params = {}
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    55
    new_params['logic'] = soc.logic.models.site.logic
708
89f1a8c2ea59 Some cleanups in role.py and site.py and create()
Sverre Rabbelier <srabbelier@gmail.com>
parents: 706
diff changeset
    56
    new_params['rights'] = rights
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    57
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    58
    new_params['name'] = "Site Settings"
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    59
    new_params['name_short'] = "Site"
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    60
    new_params['url_name'] = "site/settings"
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    61
    new_params['module_name'] = "site"
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    62
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    63
    new_params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s', 'edit')]
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    64
    new_params['sidebar_heading'] = new_params['name_short']
542
7cc99461b64d Remove redundant dicts for URL patterns and sidebar menu text, and use the
Todd Larsen <tlarsen@google.com>
parents: 537
diff changeset
    65
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    66
    new_params['public_template'] = 'soc/home/public.html'
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
660
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    68
    patterns = []
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    69
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    70
    page_name = "Home Page"
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    71
    patterns += [(r'^$', 'soc.views.models.%(module_name)s.main_public', 
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    72
                  page_name)]
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    73
702
e3b91b6955ff Remove bogus scope from Site
Sverre Rabbelier <srabbelier@gmail.com>
parents: 660
diff changeset
    74
    page_name = "Edit Site"
710
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 708
diff changeset
    75
    patterns += [(r'^%(url_name)s/(?P<access_type>edit)$',
660
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    76
                  'soc.views.models.%(module_name)s.main_edit',
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    77
                  page_name)]
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    78
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    79
    new_params['extra_django_patterns'] = patterns
5a381b290691 Introduced django_extra_patterns
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    80
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    81
    params = dicts.merge(params, new_params)
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    82
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 624
diff changeset
    83
    super(View, self).__init__(params=params)
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    84
706
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    85
  def getSidebarMenus(self, request, params=None):
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    86
    """See base.View.getSidebarMenus.
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    87
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    88
    Returns a custom sidebar entry for the 'site' singleton.
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    89
    """
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    90
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    91
    entity = self._logic.getFromFields(link_id=self._logic.DEF_SITE_LINK_ID)
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    92
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    93
    submenus = []
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    94
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    95
    if entity:
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    96
      submenus = document_view.view.getMenusForScope(entity, self._params)
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    97
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    98
    new_params = {}
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
    99
    new_params['sidebar_additional'] = submenus
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
   100
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
   101
    params = dicts.merge(params, new_params)
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
   102
    return super(View, self).getSidebarMenus(request, params=params)
19f55eb5f194 Add site scoped documents to the Site menu
Sverre Rabbelier <srabbelier@gmail.com>
parents: 702
diff changeset
   103
559
44e50e92621e Fix names of methods in soc.views.model.site.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 554
diff changeset
   104
  def mainPublic(self, request, page_name=None, **kwargs):
499
d22e4fe8e64b Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 494
diff changeset
   105
    """Displays the main site settings page.
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   106
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   107
    Args:
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   108
      request: the standard Django HTTP request object
500
44ea4620c5c0 Replace old page parameter doc string description with new one for page_name.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 499
diff changeset
   109
      page_name: the page name displayed in templates as page and header title
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
      kwargs: not used
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   111
    """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   113
    keys = self._logic.getKeyFieldNames()
537
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   114
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   115
    # No entity in this case, since Site key values are hard-coded for the
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   116
    # Site singleton, so pass in None to match parent method footprint.
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   117
    values = self._logic.getKeyValues(None)
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   118
    key_values = dicts.zip(keys, values)
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   119
710
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 708
diff changeset
   120
    return self.public(request, "show", page_name, **key_values)
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   121
559
44e50e92621e Fix names of methods in soc.views.model.site.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 554
diff changeset
   122
  def mainEdit(self, request, page_name=None, **kwargs):
499
d22e4fe8e64b Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 494
diff changeset
   123
    """Displays the edit page for the main site settings page.
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   124
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   125
    Args:
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   126
      request: the standard Django HTTP request object
500
44ea4620c5c0 Replace old page parameter doc string description with new one for page_name.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 499
diff changeset
   127
      page_name: the page name displayed in templates as page and header title
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   128
      kwargs: not used
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   129
    """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   130
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   131
    keys = self._logic.getKeyFieldNames()
537
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   132
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   133
    # No entity in this case, since Site key values are hard-coded for the
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   134
    # Site singleton, so pass in None to match parent method footprint.
f2bd9c465a6d Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents: 536
diff changeset
   135
    values = self._logic.getKeyValues(None)
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   136
    key_values = dicts.zip(keys, values)
717
f3f43ba566ef Fixed missing header in site settings.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 710
diff changeset
   137
    
f3f43ba566ef Fixed missing header in site settings.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 710
diff changeset
   138
    return self.edit(request, "edit", page_name, seed=key_values, **key_values)
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   139
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   140
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   141
view = View()
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   142
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   143
create = view.create
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   144
edit = view.edit
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   145
delete = view.delete
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   146
list = view.list
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   147
public = view.public
858
e79e7a22326f Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents: 808
diff changeset
   148
export = view.export
559
44e50e92621e Fix names of methods in soc.views.model.site.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 554
diff changeset
   149
main_public = view.mainPublic
44e50e92621e Fix names of methods in soc.views.model.site.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 554
diff changeset
   150
main_edit = view.mainEdit
858
e79e7a22326f Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents: 808
diff changeset
   151