~juju-gui-charmers/charms/trusty/juju-gui/trunk

« back to all changes in this revision

Viewing changes to server/guiserver/bundles/utils.py

  • Committer: Francesco Banconi
  • Date: 2015-06-04 17:26:08 UTC
  • mfrom: (60.13.186 develop-trunk)
  • Revision ID: francesco.banconi@canonical.com-20150604172608-7z11fddzae8qgcdg
New charm release with Juju GUI 1.4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
182
182
    """Require the user to be authenticated when executing the decorated view.
183
183
 
184
184
    This function can be used to decorate bundle views. Each view receives
185
 
    a request and a deployer, and the user instance is stored in request.user.
186
 
    If the user is not authenticated an error response is raised when calling
187
 
    the view. Otherwise, the view is executed normally.
 
185
    a request and a zero or more other arguments.
 
186
    The user instance is stored in request.user. If the user is not
 
187
    authenticated an error response is raised when calling the view. Otherwise,
 
188
    the view is executed normally.
188
189
    """
189
190
    @wraps(view)
190
 
    def decorated(request, deployer):
 
191
    def decorated(request, *args, **kwargs):
191
192
        if not request.user.is_authenticated:
192
193
            raise response(error='unauthorized access: no user logged in')
193
 
        return view(request, deployer)
 
194
        return view(request, *args, **kwargs)
194
195
    return decorated
195
196
 
196
197