Exemplo n.º 1
0
 def logout(self, targetURL=h.encodeURL("/")):
     "Logout"
     # If the person is logged in,
     if h.isPerson():
         del session["minutesOffset"]
         del session["personID"]
         del session["nickname"]
         session.save()
     # Redirect
     return redirect(url(h.decodeURL(targetURL)))
Exemplo n.º 2
0
 def logout(self, targetURL=h.encodeURL('/')):
     'Logout'
     # If the person is logged in,
     if h.isPerson():
         del session['minutesOffset']
         del session['personID']
         del session['nickname']
         session.save()
     # Redirect
     return redirect(url(h.decodeURL(targetURL)))
Exemplo n.º 3
0
 def new(self, format='html'):
     'GET /scenarios/new: Show form to create a new item'
     # If the user is not logged in,
     if not h.isPerson():
         # Redirect to login
         return redirect(url('person_login', targetURL=h.encodeURL(h.url('new_scenario'))))
     # Make sure that the requested metric model exists
     metricModelNames = metric.getModelNames()
     metricModelName = request.GET.get('metricModel')
     if metricModelName not in metricModelNames:
         metricModelName = metricModelNames[0]
     c.metricModel = metric.getModel(metricModelName)
     c.metricConfiguration = {}
     # Make sure that the requested network model exists
     networkModelNames = network.getModelNames()
     networkModelName = request.GET.get('networkModel')
     if networkModelName not in networkModelNames:
         networkModelName = networkModelNames[0]
     c.networkModel = network.getModel(networkModelName)
     c.networkConfiguration = {}
     # Render form
     c.scenario = None
     return render('/scenarios/new.mako')