gestion dates et debug
This commit is contained in:
parent
e1c393fe85
commit
601909c7cf
3 changed files with 43 additions and 41 deletions
BIN
baseFilms.db
BIN
baseFilms.db
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
d# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Mon Aug 21 13:54:39 2017
|
||||
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
Created on Thu Feb 1 22:49:56 2018
|
||||
|
||||
@author: alice
|
||||
|
||||
TODO :
|
||||
* simplifier l'input autant que possible
|
||||
* remplir
|
||||
* débug
|
||||
* documenter
|
||||
"""
|
||||
|
||||
import sqlite3
|
||||
|
@ -11,11 +17,6 @@ from datetime import date
|
|||
import locale
|
||||
locale.setlocale(locale.LC_ALL, 'fr_FR.utf8')
|
||||
|
||||
"""TODO :
|
||||
gérer liste acteurs : une autre table (id, idFilm, String acteur)
|
||||
gérer date
|
||||
"""
|
||||
|
||||
class filmSQ():
|
||||
|
||||
def __init__(self, dic):
|
||||
|
@ -74,7 +75,7 @@ class filmSQ():
|
|||
|
||||
def __getattr__(self, nom):
|
||||
conn = sqlite3.connect("baseFilms.db", detect_types=sqlite3.PARSE_DECLTYPES)
|
||||
#conn.row_factory = sqlite3.Row
|
||||
conn.row_factory = sqlite3.Row
|
||||
c = conn.cursor()
|
||||
try:
|
||||
if nom == 'acteurs':
|
||||
|
@ -212,7 +213,7 @@ class filmSQ():
|
|||
res += '</div> </div> </body> </html>'
|
||||
return res
|
||||
|
||||
def maxId():
|
||||
def maxId():
|
||||
try:
|
||||
conn = sqlite3.connect("baseFilms.db")
|
||||
|
||||
|
@ -228,7 +229,7 @@ def maxId():
|
|||
|
||||
return r[0]
|
||||
|
||||
def printAll():
|
||||
def printAll():
|
||||
try:
|
||||
conn = sqlite3.connect("baseFilms.db")
|
||||
|
||||
|
@ -260,8 +261,9 @@ def newFilm():
|
|||
|
||||
dic['i'] = i+1
|
||||
dic['idN'] = input("identifiant du film ? ")
|
||||
d = eval(input("date de la séance (format (JJ, MM, AAAA) "))
|
||||
dic['date'] = date(d[2], d[1], d[0])
|
||||
d = input("date de la séance (format JJ/MM/AAAA ) ")
|
||||
d = d.split("/")
|
||||
dic['date'] = date(int(d[2]), int(d[1]), int(d[0]))
|
||||
dic['nom'] = input("titre ? ")
|
||||
dic['acteurs'] = eval(input("acteurs (format [acteur1, acteur2, ..]) ? "))
|
||||
dic['realisateur'] = input("realisateur ? ")
|
||||
|
@ -278,5 +280,5 @@ def newFilm():
|
|||
|
||||
print(dic)
|
||||
seance = filmSQ(dic)
|
||||
return (dic,seance)
|
||||
return seance
|
||||
|
||||
|
|
Loading…
Reference in a new issue