Subversion Repositories SmartDukaan

Rev

Rev 203 | Rev 264 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 203 Rev 238
Line 5... Line 5...
5
'''
5
'''
6
 
6
 
7
from elixir import *
7
from elixir import *
8
from datastore.DataCodeDefinition import *
8
from datastore.DataCodeDefinition import *
9
 
9
 
-
 
10
def initialize_table():
-
 
11
    init()
-
 
12
    
10
def get_code_word_byId(id):
13
def get_code_word_byId(id):
-
 
14
    try:
11
    cw = code_words.query.filter_by(id=id)
15
        cw = code_words.query.filter_by(id=id).one()
-
 
16
    except:
-
 
17
        cw = "EMPTY"
12
    return cw
18
    return cw
13
   
19
   
14
def get_code_word_byKey(key):
20
def get_code_word(key):
-
 
21
    try:
15
    cw = code_words.query.filter_by(key=key)
22
        cw = code_words.query.filter_by(key=key).one()
-
 
23
        cw = cw.value
-
 
24
        print key
-
 
25
        print cw
-
 
26
    except:
-
 
27
        cw = "EMPTY"
16
    return cw
28
    return cw
17
 
29
 
18
def get_allcode_words(key):
30
def get_allcode_words(key):
-
 
31
    try:
19
    cw = code_words.query.all()
32
        cw = code_words.query.all()
-
 
33
    except:
-
 
34
        cw = "EMPTY"
-
 
35
    return cw
-
 
36
 
-
 
37
def get_code_word_byKey(key):
-
 
38
    try:
-
 
39
        cw = code_words.query.filter_by(key=key).one()
-
 
40
    except:
-
 
41
        cw = "EMPTY"
20
    return cw
42
    return cw
21
 
43
 
22
 
44
 
23
def set_code_word(key,value,description):
45
def set_code_word(key,value,description):
-
 
46
    try:
24
    cw = code_words.query.filter_by(key=key).one()
47
        cw = code_words.query.filter_by(key=key).one()
25
    ct = cw.count()
-
 
26
    if ct != 0:
-
 
27
        print value
48
        #print value
28
        print description
49
        #print description
29
        cw.value = value
50
        cw.value = value
30
        cw.description = description
51
        cw.description = description
31
    else:
52
    except:
32
        cw = code_words()
53
        cw = code_words()
33
        cw.key = key
54
        cw.key = key
34
        cw.value = value
55
        cw.value = value
35
        cw.description = description
56
        cw.description = description
36
    session.commit()    
57
    session.commit()    
37
 
58
 
38
def initialize_table():
-
 
39
    init()    
-
 
40
59
    
-
 
60
41
61