Esempio n. 1
0
def _processRequest():
    ret = SESSINFO.initSession()
    if ret != True:
        _sendError()
        return

    form = SESSINFO.getForm()
    row = UTIL.toInt(form.getvalue("row"))
    col = UTIL.toInt(form.getvalue("col"))
    status = SESSINFO.getSessionInfo().getStatus()

    rowcol = CONST.getAllowedRowCol(row, col, status)

    if row != rowcol[0] or col != rowcol[1]:
        _sendError()
        return
    msg = inboxdata.getInboxBodyObj(row, col)
    _sendReply(msg)
Esempio n. 2
0
 def __init__(self,fieldName, parentTableName, idList=None):
     
     if len(idList) > 4:
         raise ValueError('Maximum expected length is , given %d'%len(idList))
     
     DBINT.DBFieldItem.__init__(self,fieldName)
     intIdList = []
     self.parentTableName = parentTableName
     for id in idList:
         intIdList.append(NUTIL.toInt(id))
     val = self._combineFields(list)
     self.addValue(val)
Esempio n. 3
0
def validateChainedData(tableName, dofullcheck,*valList):
    '''
    Validates the chained combo data. Checks the databases to see if the
    given list is valid or not
    '''
    
    newValList = []
    
    for val in valList:
        val2 = UTIL.toInt(val)
        if val2 != None:
            newValList.append(val2)
    
    for val in newValList:
        if tableName == None:
            return False
        
        group = DBINT.DBFieldGroup('DB1', tableName)
        DBINT.setDBReadGroup(group,'id', 'childtable')
        
        statsItem = DBINT.DBFieldItem('status', 'ACTIVE')
        idItem = DBINT.DBFieldItem('id', val)
        qGroup = DBINT.QueryGroupAnd([statsItem, idItem])
        
        group.setQueryGroup(qGroup)
        
        ret = group.read()
        if ret == False:
            return False
        id = group.getItem('id').getValue(0)
        if id == None:
            return False
        tableName = group.getItem('childtable').getValue(0)
        
    if dofullcheck == True and tableName != None:
        return False
    
    return True
Esempio n. 4
0
def _AddInfo(form):
    
    uname = None
    sessid = None
    
    group = DBINT.DBFieldGroup('DB1','credentials')

    item = DBINT.DBFieldItem('uname')
    item.addValue(form.getvalue(_gWns.getAltId('PROFID')))
    item.setValidateFunction(VALD.validateUsername)
    group.addItem(item)
    
    uname = item.getValue(0)
    
    item = DBINT.DBFieldItem('name')
    item.addValue(_removeExtraSpace(form.getvalue(_gWns.getAltId('NAME'))))
    item.setValidateFunction(VALD.validateFullname)
    group.addItem(item)
    
    item = DBINT.DBFieldItem('pwd')
    item.addValue(form.getvalue(_gWns.getAltId('PASSWORD')))
    item.setValidateFunction(VALD.validatePassword)
    group.addItem(item)
    
    item = DBINT.DBFieldItem('email')
    item.addValue(form.getvalue(_gWns.getAltId('EMAIL')))
    item.setValidateFunction(VALD.validateEmail)
    group.addItem(item)
    
    item = DBINT.DBFieldItem('status')
    item.addValue(NCONST.REGISTERED)
    group.addItem(item)
    
    
    sessid = '1'+UTIL.createSessionId();
    
    item = DBINT.DBFieldItem('sessionid')
    item.addValue(sessid)
    group.addItem(item)
    
    item = DBINT.DBFieldItem('langid')
    item.addValue('eng')
    group.addItem(item)
    
    now = datetime.datetime.now()
    
    item = DBINT.DBFieldItem('doj')
    item.addValue(now)
    group.addItem(item)
    
    item = DBINT.DBFieldItem('doll')
    item.addValue(now)
    group.addItem(item)
    try:
        dobVal = datetime.date(int(form.getvalue(_gWns.getAltId('DOB_YEAR'))), int(form.getvalue(_gWns.getAltId('DOB_MONTH'))),int(form.getvalue(_gWns.getAltId('DOB_DAY'))))
    except:
        dobVal = None
    item = DBINT.DBFieldItem('dob')
    item.addValue(dobVal)
    item.setValidateFunction(VALD.validateDob)
    group.addItem(item)

    item = DBINT.DBFieldItem('sex')
    item.addValue(UTIL.toInt(form.getvalue(_gWns.getAltId('SEX'))))
    item.setValidateFunction(VALD.validateSex)
    group.addItem(item)
    
    _setSessionInfo(uname, sessid)
    
    return group.write()