app/soc/views/models/presence.py
changeset 2384 71780864a5ed
parent 2076 1cd180cc56c9
child 2388 eb1a6abdb056
equal deleted inserted replaced
2382:3a6302dd346b 2384:71780864a5ed
    31 from soc.logic import dicts
    31 from soc.logic import dicts
    32 from soc.logic.models import document as document_logic
    32 from soc.logic.models import document as document_logic
    33 from soc.views import helper
    33 from soc.views import helper
    34 from soc.views.helper import access
    34 from soc.views.helper import access
    35 from soc.views.helper import decorators
    35 from soc.views.helper import decorators
       
    36 from soc.views.helper import redirects
    36 from soc.views.helper import widgets
    37 from soc.views.helper import widgets
    37 from soc.views.models import base
    38 from soc.views.models import base
    38 
    39 
    39 import soc.models.presence
    40 import soc.models.presence
    40 import soc.logic.models.presence
    41 import soc.logic.models.presence
   128       return False
   129       return False
   129 
   130 
   130     home_doc.content = helper.templates.unescape(home_doc.content)
   131     home_doc.content = helper.templates.unescape(home_doc.content)
   131     context['home_document'] = home_doc
   132     context['home_document'] = home_doc
   132 
   133 
   133     return True
   134     # check if the current user is allowed edit the home document
       
   135     rights = self._params['rights']
       
   136 
       
   137     allowed_to_edit = False
       
   138 
       
   139     try:
       
   140       # use the IsDocumentWritable check because we have no django args
       
   141       rights.checkIsDocumentWritable({'key_name': home_doc.key().name(),
       
   142                                       'prefix': home_doc.prefix,
       
   143                                       'scope_path': home_doc.scope_path,
       
   144                                       'link_id': home_doc.link_id},
       
   145                                       'key_name')
       
   146       allowed_to_edit = True
       
   147     except:
       
   148       pass
       
   149 
       
   150     if allowed_to_edit:
       
   151       # put the link to edit to home document in context
       
   152       context['home_document_edit_redirect'] = redirects.getEditRedirect(
       
   153           home_doc, {'url_name': 'document'})
       
   154 
       
   155     return super(View, self)._public(request, entity, context)
   134 
   156 
   135   def _editGet(self, request, entity, form):
   157   def _editGet(self, request, entity, form):
   136     """See base.View._editGet().
   158     """See base.View._editGet().
   137     """
   159     """
   138 
   160