Example #1
0
def try_connecting():
    i = 0
    db = DataBase("budget", "192.168.1.100", "Budget", "matix0508", "G@d#ryp0luk!")
    while not (db.connected or i == 10):
        try:
            db.db_connect()
        except:
            i+=1
            db = DataBase("budget", "192.168.1.10{i}", "Budget", "matix0508", "G@d#ryp0luk!")
    if db.connected:
        db.close()
        return db
Example #2
0
 def __init__(self, account, clientServer):
     Tk.__init__(self)
     self.title("Inbox")
     self.config(bg="#3a4860")
     self.clientServer = clientServer
     self.account = account
     self.database = DataBase()
     exit_button = Button(self, text="Exit",
                          command=self.quit,
                          bg="black", fg="red")
     exit_button.grid(row=8, column=1, columnspan=2, rowspan=2,
                      padx=5, pady=5)
     self.transaction_phase()
     print("Transaction finished")
     message_content = self.database.fetch_mail_from_account(
         self.account.split("@")[0])
     print("Messages")
     print(message_content)
     for i, mail in enumerate(message_content):
         Label(self, text=mail['Data'], fg="#ffffff", bg="#576884").grid(
             row=20 + i*2, column=1, columnspan=2, rowspan=2,
             padx=5, pady=5, sticky=W+E+N+S)
     if(len(message_content) == 0):
         Label(self, "No messages", fg="#ffffff", bg="#576884").grid(
             row=20 + 2, column=1, columnspan=2, rowspan=2,
             padx=5, pady=5, sticky=W+E+N+S)
Example #3
0
 def handle_mail(self, socket, mail_from, mail_to, message):
     print("Handling mail")
     domain = mail_to.split("@")[1].replace(">", "")
     if (domain == self.domain):
         database = DataBase()
         database.save_Mail(mail_from, mail_to, message)
     else:
         print("sending to..." + domain)
         self.send_mail(domain, mail_from, mail_to, message)
Example #4
0
 def __init__(self, selected_date, status):
     #data hardcode for now, should come from database
     self.database = DataBase()
     self.date = selected_date
     self.photo = []
     self.tag = []
     self.text = None
     if status == 'old':
         loaded_values = self.database.getData(self.date)
         self.text = loaded_values[0]
         self.tag.extend(loaded_values[1].split(','))
         self.photo.extend(loaded_values[2].split(','))
Example #5
0
File: ABC.py Project: AlyAhmad1/IMS
from flask import Flask, render_template, url_for, redirect, request, session, make_response
from flask_wtf import FlaskForm, RecaptchaField, file
from wtforms import StringField, PasswordField
from wtforms.validators import InputRequired, AnyOf
from functools import wraps
from DB import DataBase
from datetime import timedelta
import os
import sys
DB_obj = DataBase()

Application = Flask(__name__)
Application.config['SECRET_KEY'] = '!2#4%6&8(0Ali'


# making login_required decorator
def login_required(f):
    @wraps(f)
    def wrap(*args, **kwargs):
        if 'user' in session:
            session.permanent = True
            Application.permanent_session_lifetime = timedelta(minutes=5)
            return f(*args, **kwargs)
        else:
            return redirect(url_for('login'))

    return wrap
Example #6
0
 def __init__(self, selected_date):
     self.day = selected_date
     self.database = DataBase()
     self.slot = True
Example #7
0
 def __init__(self):
     self.currtable = str(INVALIDTABLE)
     self.datb = DataBase("fuller.db")
Example #8
0
 def __init__(self):
     self.database = DataBase()
Example #9
0
 def __init__(self):
     self.smtp_port = 8080
     self.domain = "grupo01.com"
     self.host = gethostbyname(gethostname())
     self.database = DataBase()