Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

User Story #6342 (closed)

Opened 8 years ago

Closed 7 years ago

Connection provider and decorators in webclient

Reported by: atarkowska Owned by: atarkowska
Priority: major Milestone: OMERO-4.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 jmoore)

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

Shares & Sessions

Previous to 4.4, the creation of sessions for shares used the stored username/password to create a new session. Part of the refactoring described above will remove that stored username/password. However, it is not necessarily possible for a user to create a new session from an existing session (this is only allowed if the session is authenticated with a password). Nevertheless it is necessary to be able to activate a session for one user in one process without effecting the other processes that are currently using the same process. Josh and Chris have agreed that extending the {"omero.group":"1"} functionality to also support shares should simplify things greatly. Each method invocation, regardless of group or session, can pass a share setting essentially activating that share for the duration of the method call. This will take place as a part of #3529.

Change History (13)

comment:1 Changed 8 years ago by atarkowska

  • Milestone changed from OMERO-Beta4.3.2 to Unscheduled

comment:2 Changed 8 years ago by atarkowska

  • Description modified (diff)

comment:3 Changed 8 years ago by atarkowska

  • Description modified (diff)

comment:4 Changed 8 years ago by atarkowska

  • Milestone changed from Unscheduled to OMERO-Beta4.4

comment:5 Changed 8 years ago by wmoore

  • Description modified (diff)

comment:6 Changed 8 years ago by wmoore

  • Description modified (diff)

comment:7 Changed 8 years ago by wmoore

  • Description modified (diff)

comment:8 Changed 8 years ago by cxallan

  • Description modified (diff)

comment:9 Changed 8 years ago by cxallan

  • Description modified (diff)

comment:10 Changed 8 years ago by agilo

  • Status changed from new to accepted

Updated status, related task in progress

comment:11 Changed 8 years ago by jmoore

  • Cc jburel added
  • Description modified (diff)

comment:12 Changed 8 years ago by cxallan

Integration branch now available for OMERO.web:

comment:13 Changed 7 years ago by atarkowska

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.221405 sec.)

We're Hiring!