Beispiel #1
0
 def test_execution(self):
     node_search = NodeSearch("1")
     node_search.execute()
     self.assertIsNone(node_search.result)
     node_key = Node(id=1).put()
     node_search.execute()
     self.assertEqual(node_key, node_search.result.key)
Beispiel #2
0
def get_locacao_cmd(locacao_id):
    """
    Find locacao by her id
    :param locacao_id: the locacao id
    :return: Command
    """
    return NodeSearch(locacao_id)
Beispiel #3
0
def get_course_cmd(course_id):
    """
    Find course by her id
    :param course_id: the course id
    :return: Command
    """
    return NodeSearch(course_id)
Beispiel #4
0
def get_comportamento_cmd(comportamento_id):
    """
    Find comportamento by her id
    :param comportamento_id: the comportamento id
    :return: Command
    """
    return NodeSearch(comportamento_id)
Beispiel #5
0
def get_lancamento_cmd(lancamento_id):
    """
    Find lancamento by her id
    :param lancamento_id: the lancamento id
    :return: Command
    """
    return NodeSearch(lancamento_id)
Beispiel #6
0
    def do_business(self):
        super(AntiSpanSearch, self).do_business()
        if self.result:
            arc = LoginUser.find_last(self.result).get()
            if arc:
                search = NodeSearch(arc.origin.id())
                search.execute()
                lg = search.result

                def is_spam(login):
                    elapsed = datetime.now() - lg.creation
                    return lg.status in (LOGIN_CALL, LOGIN_EMAIL) and elapsed < timedelta(
                        seconds=settings.LINK_EXPIRATION)

                if is_spam(lg):
                    self.add_error('spam', _('Spam not allowed'))
Beispiel #7
0
def get_venda_cmd(venda_id):
    """
    Find venda by her id
    :param venda_id: the venda id
    :return: Command
    """
    return NodeSearch(venda_id)
Beispiel #8
0
def get_filme_cmd(filme_id):
    """
    Find filme by her id
    :param filme_id: the filme id
    :return: Command
    """
    return NodeSearch(filme_id)
Beispiel #9
0
 def __init__(self, pending_id, ticket, response, user_cookie_name,
              detail_url):
     super(LoginCheckingEmail, self).__init__(
         NodeSearch(pending_id),
         Login(ticket, response, user_cookie_name, detail_url))
     self.checked = False
     self.__to_commit = None
Beispiel #10
0
def get_artigo_cmd(artigo_id):
    """
    Find artigo by her id
    :param artigo_id: the artigo id
    :return: Command
    """
    return NodeSearch(artigo_id)
Beispiel #11
0
def get_cartaz_cmd(cartaz_id):
    """
    Find cartaz by her id
    :param cartaz_id: the cartaz id
    :return: Command
    """
    return NodeSearch(cartaz_id)
Beispiel #12
0
def get_observacoe_cmd(observacoe_id):
    """
    Find observacoe by her id
    :param observacoe_id: the observacoe id
    :return: Command
    """
    return NodeSearch(observacoe_id)
Beispiel #13
0
def get_cliente_cmd(cliente_id):
    """
    Find cliente by her id
    :param cliente_id: the cliente id
    :return: Command
    """
    return NodeSearch(cliente_id)
Beispiel #14
0
def logged_user(request):
    """
    Returns a command that retrieves the current logged user based on secure cookie
    If there is no logged user, the result from command is None
    """
    dct = cookie_facade.retrive_cookie_data(request,
                                            USER_COOKIE_NAME).execute().result
    if dct is None:
        return Command()
    return NodeSearch(dct['id'])
Beispiel #15
0
 def __init__(self, site_id, site_token, hook):
     node_search = NodeSearch(site_id)
     certify_token = CertifySiteToken(site_token, node_search)
     certify_hook = CertifySiteHook(hook, node_search)
     super(CertifySiteCredentials, self).__init__(node_search, certify_token, certify_hook)
     self.site_search = node_search
Beispiel #16
0
    def __init__(self, app_id, token, ticket_id):
        site_search = NodeSearch(app_id)
        self.user_search = LoginUserSearch(ticket_id)

        super(UserDetail, self).__init__(site_search, CertifySiteToken(token, site_search),
                                         ValidateLoginStatus(ticket_id, LOGIN_CLICK, LOGIN_DETAIL), self.user_search)
Beispiel #17
0
 def handle_previous(self, command):
     self.append(NodeSearch(command.result))
     self.code = command.code
     self.status = command.status
     self.net_amount = command.net_amount
Beispiel #18
0
def get_livro(livro_id):
    return NodeSearch(livro_id)