User Story #6342 (new)
Opened 13 years ago
Last modified 12 years ago
Connection provider and decorators in webclient — at Version 8
Reported by: | atarkowska | Owned by: | atarkowska |
---|---|---|---|
Priority: | major | Milestone: | OMERO-Beta4.4 |
Component: | Web | Keywords: | n.a. |
Cc: | jburel | Story Points: | n.a. |
Sprint: | n.a. | Importance: | n.a. |
Total Remaining Time: | 0.0d | Estimated Remaining Time: | n.a. |
Description (last modified by cxallan)
Review
Due to the changes in #6387, Web should have one common strategy to create connection, keep it alive and retrieve in specific use cases. That is also related to decorators.
Tickets - DRAFT ONLY!!!
Examples of common functionality that exists (and could be moved to decorators) or that we might want to provide via decorators.
- Error handling, connection & redirect or error if json.
conn = None try: conn = kwargs["conn"] except: logger.error(traceback.format_exc()) return handlerInternalError("Connection is not available. Please contact your administrator.")
- Would be nice to allow 3rd party developers to specify templates. E.g. as in webgateway
def full_viewer(request, iid, server_id=None, _conn=None, **kwargs): .... template = kwargs.get('template', "webgateway/omero_image.html") ...etc.
- Also we have this a lot
t = template_loader.get_template(template) c = Context(request,context) logger.debug('TEMPLATE: '+template) return HttpResponse(t.render(c))
# check menu menu = request.REQUEST.get("menu") if menu is not None: request.session['nav']['menu'] = menu else: menu = request.session['nav']['menu'] # check view view = request.REQUEST.get("view") if view is not None: request.session['nav']['view'] = view else: view = request.session['nav']['view']
These lines (or equivalent) are needed in many views
request.session['nav']['menu'] = menu # menu is 'usertags', 'userdata', 'search' etc. for main menu selection context['nav'] = request.session['nav']
Due to various parameters added to the request in isUserConnected
def sessionHelper(request): ... request.session['nav']={"blitz": blitz, "menu": "mydata", "view": "tree", "basket": 0, "experimenter":None} def navHelper(request, conn): ... request.session['nav']['tab_links'] = links
Existing Decorator Examples
- Python Decorator Library (http://wiki.python.org/moin/PythonDecoratorLibrary)
- Beaker (http://beaker.groovie.org/caching.html#decorator-api)
- TurboGears? @validate(), @expose(), etc. (http://turbogears.org/2.0/docs/modules/tgdecorators.html)
- Pylons @validate(), @jsonify(), etc. (http://docs.pylonsproject.org/projects/pylons-webframework/en/latest/modules/decorators.html)
Change History (8)
comment:1 Changed 13 years ago by atarkowska
- Milestone changed from OMERO-Beta4.3.2 to Unscheduled
comment:2 Changed 13 years ago by atarkowska
- Description modified (diff)
comment:3 Changed 13 years ago by atarkowska
- Description modified (diff)
comment:4 Changed 13 years ago by atarkowska
- Milestone changed from Unscheduled to OMERO-Beta4.4
comment:5 Changed 12 years ago by wmoore
- Description modified (diff)
comment:6 Changed 12 years ago by wmoore
- Description modified (diff)
comment:7 Changed 12 years ago by wmoore
- Description modified (diff)
comment:8 Changed 12 years ago by cxallan
- Description modified (diff)