app/soc/views/models/presence.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 22 Jan 2009 16:04:48 +0000
changeset 901 d580a057103d
parent 858 e79e7a22326f
child 904 a6397daf4006
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
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 514
diff changeset
    17
"""Views for Models with a "presence" on a Melange site.
446
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 google.appengine.ext import db
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 django import forms
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
from django.utils.translation import ugettext_lazy
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    30
from soc.logic import cleaning
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
from soc.logic import dicts
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
from soc.logic import validate
452
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
    33
from soc.logic.models import document as document_logic
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
from soc.views import helper
710
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 662
diff changeset
    35
from soc.views.helper import access
844
b55c68d25b35 Make getToSLink() an actual method for re-use by others.
Todd Larsen <tlarsen@google.com>
parents: 807
diff changeset
    36
from soc.views.helper import redirects
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
from soc.views.models import base
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 514
diff changeset
    39
import soc.models.presence
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 514
diff changeset
    40
import soc.logic.models.presence
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
import soc.logic.dicts
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
import soc.views.helper
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
import soc.views.helper.widgets
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
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
class View(base.View):
844
b55c68d25b35 Make getToSLink() an actual method for re-use by others.
Todd Larsen <tlarsen@google.com>
parents: 807
diff changeset
    47
  """View methods for the Presence model.
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
  """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 632
diff changeset
    50
  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
    51
    """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
    52
    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
    53
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
    Params:
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 632
diff changeset
    55
      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
    56
    """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    57
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    58
    new_params = {}
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    59
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    60
    new_params['extra_dynaexclude'] = ['home', 'tos']
710
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 662
diff changeset
    61
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    62
    new_params['create_extra_dynafields'] = {
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    63
        # override some editors
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    64
        'home_link_id': forms.CharField(required=False,
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    65
            label=ugettext_lazy('Home page Document link ID'),
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    66
            help_text=soc.models.work.Work.link_id.help_text),
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    68
        'tos_link_id': forms.CharField(required=False,
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    69
            label=ugettext_lazy('Terms of Service Document link ID'),
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    70
            help_text=soc.models.work.Work.link_id.help_text),
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    71
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    72
        # add cleaning of the link id and feed url
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    73
        'clean_link_id': cleaning.clean_link_id,
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    74
        'clean_feed_url': cleaning.clean_feed_url,
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    75
        }
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    76
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
    77
    params = dicts.merge(params, new_params, sub_merge=True)
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 632
diff changeset
    79
    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
    80
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    81
  def _public(self, request, entity, context):
710
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 662
diff changeset
    82
    """See base.View._public().
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    83
    """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    84
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    85
    if not entity:
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    86
      return
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    87
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    88
    try:
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    89
      home_doc = entity.home
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    90
    except db.Error:
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
      home_doc = None
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    92
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    93
    if home_doc:
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    94
      home_doc.content = helper.templates.unescape(home_doc.content)
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    95
      context['home_document'] = home_doc
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    96
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    97
  def _editGet(self, request, entity, form):
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    98
    """See base.View._editGet().
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    99
    """
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   100
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   101
    try:
452
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   102
      if entity.home:
807
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   103
        form.fields['home_link_id'].initial = entity.home.link_id
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
   104
    except db.Error:
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
   105
      pass
807
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   106
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
   107
    try:
807
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   108
      if entity.tos:
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   109
        form.fields['tos_link_id'].initial = entity.tos.link_id
446
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
    except db.Error:
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   111
      pass
0b479d573a4c Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
662
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
   113
    super(View, self)._editGet(request, entity, form)
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
   114
452
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   115
  def _editPost(self, request, entity, fields):
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   116
    """See base.View._editPost().
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   117
    """
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   118
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
   119
    scope_path = entity.key().name()
807
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   120
    home_link_id = fields['home_link_id']
452
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   121
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   122
    # TODO notify the user if home_doc is not found
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   123
    home_doc = document_logic.logic.getFromFields(
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
   124
      scope_path=scope_path, link_id=home_link_id)
452
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   125
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   126
    fields['home'] = home_doc
160c748988a2 Fixes to {Site,Home}Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 446
diff changeset
   127
807
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   128
    tos_link_id = fields['tos_link_id']
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   129
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   130
    # TODO notify the user if tos_doc is not found
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   131
    tos_doc = document_logic.logic.getFromFields(
901
d580a057103d Presence is now a 'abstract' View, pull in members from program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 858
diff changeset
   132
      scope_path=scope_path, link_id=tos_link_id)
807
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   133
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   134
    fields['tos'] = tos_doc
b6db9fb1246d Hack in tos_scope_path and tos_link_id to select Terms of Service Document.
Todd Larsen <tlarsen@google.com>
parents: 799
diff changeset
   135
662
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
   136
    super(View, self)._editPost(request, entity, fields)