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)])
Esempio n. 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()
Esempio n. 3
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"
Esempio n. 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"
Esempio n. 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
Esempio n. 6
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"
Esempio n. 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"
Esempio n. 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", "/"))
Esempio n. 9
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"
Esempio n. 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"
Esempio n. 11
0
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
     self.dao_post_tag = FACTORY.getPostTagDao()
Esempio n. 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
Esempio n. 13
0
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
     self.dao_post_tag = FACTORY.getPostTagDao()
Esempio n. 14
0
 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()
Esempio n. 15
0
 def initialize(self):
     self.dao_tag = FACTORY.getTagDao()
Esempio n. 16
0
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
Esempio n. 17
0
 def initialize(self):
     self.dao_post = FACTORY.getPostDao()
Esempio n. 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
Esempio n. 19
0
 def initialize(self):
     self.dao_tag = FACTORY.getTagDao()