Example #1
0
def add_thorn(userid, desc, thornfile):
    
    newthorn = model.thornlist()
    newthorn.userid = userid
    newthorn.description = desc
                        
    newthorn.submitted_time = time.asctime()
    newthorn.filename = str(thornfile.filename).replace(" ", "_")
    
    mmm=thornfile.file.read() 
    newthorn.thornfile = mmm 
    meta.Session.add(newthorn)
    meta.Session.commit()
Example #2
0
def get_thornlist(userid):

    all_thorns = meta.Session.query(model.thornlist)
    user_thorns = all_thorns.filter(model.thornlist.userid==userid).all()   

    default_thorn = model.thornlist()
    default_thorn.description = 'this is default'
    default_thorn.id= 'default'                    
    default_thorn.submitted_time = 'default'
         
    default_thorn.filename = 'einsteintoolkit.th'
    default_thorn.thornfile  = file(einstientoolkit_file)
        
    user_thorns.append(default_thorn)
    
    return user_thorns