Subversion Repositories SmartDukaan

Rev

Rev 238 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
203 ashish 1
'''
2
Created on 02-Jun-2010
3
 
4
@author: gaurav
5
'''
6
 
7
from elixir import *
8
from datastore.DataCodeDefinition import *
9
 
10
def get_code_word_byId(id):
11
    cw = code_words.query.filter_by(id=id)
12
    return cw
13
 
14
def get_code_word_byKey(key):
15
    cw = code_words.query.filter_by(key=key)
16
    return cw
17
 
18
def get_allcode_words(key):
19
    cw = code_words.query.all()
20
    return cw
21
 
22
 
23
def set_code_word(key,value,description):
24
    cw = code_words.query.filter_by(key=key).one()
25
    ct = cw.count()
26
    if ct != 0:
27
        print value
28
        print description
29
        cw.value = value
30
        cw.description = description
31
    else:
32
        cw = code_words()
33
        cw.key = key
34
        cw.value = value
35
        cw.description = description
36
    session.commit()    
37
 
38
def initialize_table():
39
    init()