forked from meruyert0/PythonSHop
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodule.py
43 lines (40 loc) · 1.17 KB
/
module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import time
import control
import settings
class User():
"""
This is the blue print of User Instance
"""
user_name = ''
user_pw = ''
date_created = ''
date_end=''
is_admin = False
is_staff = False
is_client = False
is_manager=False
all_users = []
def _init_(self):
with open('data/users.txt','r') as f:
user_data = f.read()
user_list = user_data.strip('\n').split('\n')
self.all_users = user_list
def add(self,user_name, user_pw):
"""
bla bal
:param user_name:
:param user_pw:
:return:
"""
time_format = "%Y-%m-%d %X %A %B %p %r"
time_current = time.strftime(time_format)
self.user_name = user_name
self.user_pw = user_pw
self.date_created = time_current
user_string = f"{self.user_name},{self.user_pw},{self.date_created},{self.is_admin},{self.is_staff},{self.is_client},{self.is_manager}"
log_message = f" Created new User: {user_string}"
control.logger(log_message)
with open("data/users.txt",'a') as f:
f.write(user_string)
f.write('\n')
self._init_()