main
Last change
on this file was
42bd667,
checked in by David Fuertes <dfuertes@…>, 4 years ago
|
Historial Limpio
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | # -*- coding: utf-8 -*- |
---|
2 | ################################################################################# |
---|
3 | # @file global_context.py |
---|
4 | # @brief Module that store all objects of connection (remote_pc_data, db, ...etc). |
---|
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 2020-02-04 |
---|
11 | ################################################################################# |
---|
12 | |
---|
13 | from gluon.storage import Storage |
---|
14 | |
---|
15 | |
---|
16 | class Context(): |
---|
17 | |
---|
18 | def __init__(self): |
---|
19 | self.context = Storage() |
---|
20 | |
---|
21 | |
---|
22 | def add_context(**kwargs): |
---|
23 | #print('adding context') |
---|
24 | #print(kwargs) |
---|
25 | global __context |
---|
26 | |
---|
27 | if kwargs: |
---|
28 | __context.update(kwargs) |
---|
29 | |
---|
30 | def get_context(*args): |
---|
31 | return_objects = {} |
---|
32 | if args: |
---|
33 | if len(args) > 1: |
---|
34 | for obj in args: |
---|
35 | return_objects.update({obj : __context[obj]}) |
---|
36 | return return_objects |
---|
37 | else: |
---|
38 | return __context[args[0]] |
---|
39 | else: |
---|
40 | return __context |
---|
41 | |
---|
42 | |
---|
Note: See
TracBrowser
for help on using the repository browser.