예제 #1
0
def get_list_choices_by_phone():

    choices_cached = memcache.get('list-choices-phone')

    if choices_cached is None:

        q = List.all().filter('uses_sms =', True).fetch(20)
        choices = []
            
        if len(q) > 0:
            for choice in q:
                choices.append((str(choice.key()), choice.name))

        
            memcache.set('list-choices-phone', choices)
            return choices
        else:
            return []
    else:
        return choices_cached        
예제 #2
0
def get_list_choices():

    choices_cached = memcache.get('list-choices')

    if choices_cached is None:

        q = List.all().filter('show_public =', True).fetch(20)
        choices = []
            
        if len(q) > 0:
            for choice in q:
                choices.append((str(choice.key()), choice.form_question))

        
            memcache.set('list-choices', choices)
            return choices
        else:
            return []
    else:
        return choices_cached