def from_sql(self, utoken):
    (cur, con) = mysql_connect()
    try:
        qstr = sql_selectall('uploadtokens', ['tokenid'], [utoken], [sq.token])
    except SQLParamError:
        do_param_error('UploadToken.from_sql')
        raise SQLParamError()
    cur.execute(qstr)
    ret = cur.fetchone()
    if (ret == None):
        self.invalid = True
        return
    self.token = ret['tokenid']
    self.path = ret['path']
    self.time = ret['time']
    self.name = ret['name']
    self.fileid = ret['fileid']
    self.realpath = ret['realpath']
    self.userid = ret['userid']
    self.permissions = ret['permissions']
    self.expiration = ret['expiration']
    self.size = ret['size']
    self.cur = ret['cur']
def from_sql(self, utoken):
    (cur, con) = mysql_connect()
    try:
        qstr = sql_selectall('uploadtokens', ['tokenid'], [utoken], [sq.token])
    except SQLParamError:
        do_param_error('UploadToken.from_sql')
        raise SQLParamError()
    cur.execute(qstr)
    ret = cur.fetchone()
    if (ret == None):
        self.invalid = True
        return
    self.token = ret['tokenid']
    self.path = ret['path']
    self.time = ret['time']
    self.name = ret['name']
    self.fileid = ret['fileid']
    self.realpath = ret['realpath']
    self.userid = ret['userid']
    self.permissions = ret['permissions']
    self.expiration = ret['expiration']
    self.size = ret['size']
    self.cur = ret['cur']