source: OpenRLabs-Git/web2py/applications/rlabs/controllers/events.py

main
Last change on this file was f03481a, checked in by David Fuertes <dfuertes@…>, 4 years ago

Terminado instalador fullstack

  • Property mode set to 100644
File size: 2.0 KB
Line 
1# -*- coding: utf-8 -*-
2#################################################################################
3# @file    events.py
4# @brief   Controller for clients events   
5# @warning None
6# @note Use: None     
7# @license GNU GPLv3+
8# @author  David Fuertes, EUPT, University of Zaragoza.
9# @version 1.1.0 - First version
10# @date    2019-15-11
11#################################################################################
12# -------------------------------------------------------------------------
13# Controller for clients events
14# -------------------------------------------------------------------------
15import gluon # quitar en produccion. Sirve para que eclipse no de errores.
16
17from gluon.storage import Storage
18
19
20from ognsys import Ognsys
21from client_lab import Client
22from ados import adoDB_reserves
23
24def getEventsLogin():
25    print('Evento producido: login')
26    #print(request.vars.pc_id)
27    '''   
28    parametros_sesion_registrados = clients.register_session_timeout(request.vars.ou_id,
29                                                              request.vars.lab_id,                                         
30                                                              request.vars.pc_id,
31                                                              request.vars.maxtime)
32    '''
33   
34    #print(parametros_sesion_registrados)       
35       
36
37def getEventsLogout():
38    print('Evento producido: logout')
39
40    tmp_d = {}
41    for k,v in request.vars.items():
42        if 'amp;' in k:
43            nk = k.replace('amp;', '')
44            tmp_d.update({nk: v})
45
46    request.vars.update(tmp_d)
47   
48    opengnsys = Ognsys(db)
49    if opengnsys.set_apikey(request.vars.ou_id): 
50             
51        my_context = Storage(**request.vars)
52        my_context['db'] = db
53       
54        client = Client(my_context)       
55        client.unreserve_remote_pc()
56       
57    else:
58        print({'error' : 'Error de inicialización'})
59   
60   
61def getEventsWindowUnload():   
62    print('Evento producido: Window Unload (closed, refresh, others')
63       
64       
Note: See TracBrowser for help on using the repository browser.