def initialize(self):
     self.dao_post = FACTORY.getPostDao()
     self.dao_tag = FACTORY.getTagDao()
     self.tags = self.dao_tag.get_all()
     self.posts = []
     for post in self.dao_post.get_all():
         self.posts.append([post, get_tags(post.id)])
Example #2
0
 def setUp(self):
     self.dao_tag = FACTORY.getTagDao()
     #        self.dao_tag.delete_all()
     self.dao_post = FACTORY.getPostDao()
     #        self.assertTrue(self.dao_post.delete_all())
     self.dao_user = FACTORY.getUserDao()
     #        self.assertTrue(self.dao_user.delete_all())
     self.dao_post_tag = FACTORY.getPostTagDao()
def insert_user():
    dao_user = FACTORY.getUserDao()

    password_ok = False
    username_ok = False
    while not username_ok and not password_ok:
        nome = raw_input("Informe o Nome: ")
        username = raw_input("Informe o email: ")
        if dao_user.check_user(username):
            print "Email já existe."
            continue
        password = getpass.getpass("Informe a senha: ")
        password_repeat = getpass.getpass("Informe novamente a senha: ")
        if password == password_repeat:
            password_ok = True
        else:
            print "Senhas não conferem."
    user = User(
        nome,
        username,
        password,
    )

    if dao_user.insert(user):
        print "\nUsuario salvo\n"
    else:
        print "\nErro\n"
Example #4
0
def insert_user():
    dao_user = FACTORY.getUserDao()

    password_ok = False
    username_ok = False
    while not username_ok and not password_ok:
        nome = raw_input("Informe o Nome: ")
        username = raw_input("Informe o email: ")
        if dao_user.check_user(username):
            print "Email já existe."
            continue
        password = getpass.getpass("Informe a senha: ")
        password_repeat = getpass.getpass("Informe novamente a senha: ")
        if password == password_repeat:
            password_ok = True
        else:
            print "Senhas não conferem."
    user = User(
        nome,
        username,
        password,
    )

    if dao_user.insert(user):
        print "\nUsuario salvo\n"
    else:
        print "\nErro\n"
Example #5
0
def monta_tags():
    dao_tag = FACTORY.getTagDao()
    tags = []
    for tag in dao_tag.get_all():
        tag = (str(tag.id), tag.nome)
        tags.append(tag)
    return tags
def list_users():
    dao_user = FACTORY.getUserDao()
    users = dao_user.get_all()
    if users:
        for user in users:
            print "nome: %s | email: %s\n" % (user.nome, user.email)
    else:
        print "\nNenhum usuario\n"
Example #7
0
def list_users():
    dao_user = FACTORY.getUserDao()
    users = dao_user.get_all()
    if users:
        for user in users:
            print "nome: %s | email: %s\n" % (user.nome, user.email)
    else:
        print "\nNenhum usuario\n"
Example #8
0
 def post(self):
     getusername = self.get_argument("username")
     getpassword = self.get_argument("password")
     dao = FACTORY.getUserDao()
     if dao.check_permission(getusername, getpassword):
         self.set_secure_cookie("user", getusername, expires_days=None)
         self.redirect(self.get_argument("next", "/"))
     else:
         self.render('login.html',
                     errormessage="Usuário ou senha incorretos!",
                     next=self.get_argument("next", "/"))
def excluir_user():
    dao_user = FACTORY.getUserDao()

    username = raw_input("Informe o email: ")
    user = dao_user.check_user(username)
    if user:
        excluido = dao_user.delete_um(user.id)
        if excluido:
            print "\nUsuario excluido\n"
        else:
            print "\nErro\n"
    else:
        print "\nUsuario não existe \n"
Example #10
0
def excluir_user():
    dao_user = FACTORY.getUserDao()

    username = raw_input("Informe o email: ")
    user = dao_user.check_user(username)
    if user:
        excluido = dao_user.delete_um(user.id)
        if excluido:
            print "\nUsuario excluido\n"
        else:
            print "\nErro\n"
    else:
        print "\nUsuario não existe \n"
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
     self.dao_post_tag = FACTORY.getPostTagDao()
Example #12
0
def get_tags(post_id):
    dao_post_tag = FACTORY.getPostTagDao()
    tags = [i.nome for i in dao_post_tag.get_all_tags_post(post_id)]
    return tags
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
     self.dao_post_tag = FACTORY.getPostTagDao()
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
     self.dao_tag = FACTORY.getTagDao()
     self.dao_post_tag = FACTORY.getPostTagDao()
     self.tags = self.dao_tag.get_all()
     self.posts_only = self.dao_post.get_all()
 def initialize(self):
     self.dao_tag = FACTORY.getTagDao()
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
Example #18
0
def get_tags(post_id):
    dao_post_tag = FACTORY.getPostTagDao()
    tags = [i.nome for i in dao_post_tag.get_all_tags_post(post_id)]
    return tags
Example #19
0
 def initialize(self):
     self.dao_tag = FACTORY.getTagDao()