def login(self, username, password): """We are storing our authentication token back to our raw api on success. ::return True on success, else False """ if common.is_empty(username) and common.is_empty(password): return True current_user.set_credentials(username, password) if not current_user.login(api=self): logger.error('Cannot login with current credentials') return False return True
def color(cls, data, default=None): if common.is_empty(data): return default if data.startswith('#') and len(data) == 7: return '%sFF' % data return data
def strip_html(cls, data, default=None): if common.is_empty(data): return default return strip_tags(data)
def math_floor(cls, data, default=None): if common.is_empty(data): return default return math.floor(data)
def quote(cls, data, default=None): if common.is_empty(data): return default return urllib.quote_plus(data)
def float(cls, data, default=None): if common.is_empty(data): return default return float(data)
def string(cls, data, default=None): if common.is_empty(data): return default return str(data)