web.SQLLiteral

Here are the examples of the python api web.SQLLiteral taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: googlemodules Source File: comments.py
Function: add
def add(module_id, author, comment):
    success, err_msg = False, ''
    
    banned_word = is_banned_keyword(author + ' ' + comment)
    if banned_word:
        err_msg = 'Ooops! Please go back to remove "%s" if you can...' % banned_word
    
    elif module_id and author and comment:
        db.insert('comments',
            module_id=module_id, author=author, content=comment, 
            datetime_created=web.SQLLiteral('now()'))
        success = True
        
    return success, err_msg

Example 2

Project: googlemodules Source File: votes.py
Function: add
def add(module_id, vote, user_ip):
    if already_voted(module_id, user_ip):
        success = True
    else:
        success = False
        if module_id and -5 <= vote <= 5:
            db.insert('votes',
                module_id=module_id, vote=vote, ip=user_ip,
                datetime_created=web.SQLLiteral('now()'))
            success = True
        update_calculated_vote(module_id)
    return success