From 2acb5f034d9b1a16779b72159ca7921abcad4599 Mon Sep 17 00:00:00 2001 From: Alice Date: Mon, 25 Sep 2017 20:38:02 +0200 Subject: [PATCH] =?UTF-8?q?prochains=20films=20dans=20filmsCode2=20;=20pb?= =?UTF-8?q?=20=C3=A0=20r=C3=A9gler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cineclubBlog.py | 44 +++++++++++++++++++++++++++----------------- filmsCode2 | Bin 0 -> 1023 bytes 2 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 filmsCode2 diff --git a/cineclubBlog.py b/cineclubBlog.py index 1bd1c96..ff6fbc7 100644 --- a/cineclubBlog.py +++ b/cineclubBlog.py @@ -50,7 +50,7 @@ class film(): return res def calendrier(self): - res = '
' + res = ' \n \n
' res += '
' res += '' res += '

Retour en haut de page' - res += "

" + res += "
\n \n
" return res def bocal(self): @@ -122,14 +122,22 @@ def strListe(liste): res += liste[-1] return res -def nouveauFilm(): - with open('filmsCode', 'rb') as file: - pickler = pickle.Unpickler(file) - dicFilms = pickler.load() - with open('index', 'rb') as index: - pickler = pickle.Unpickler(index) - dicIndex = pickler.load() - i = pickler.load() + 1 +i = 38 + +def nouveauFilm(dicFilms = {}, index = {}): + ind, dic = True, True + if dicFilms == {}: + with open('filmsCode', 'rb') as file: + pickler = pickle.Unpickler(file) + dicFilms = pickler.load() + dic = False + if index == {}: + with open('index', 'rb') as index: + pickler = pickle.Unpickler(index) + dicIndex = pickler.load() + i = pickler.load() + 1 + ind = False + i += 1 idN = input("identifiant du film ? ") date = input("date de la séance (format mardi JJ MOIS AAAA) ") nom = input("titre ? ") @@ -144,13 +152,15 @@ def nouveauFilm(): seance = film(i, idN, date, nom, acteurs, realisateur, duree, synopsis, pays, annee, youtube, couleur) dicIndex[i] = idN dicFilms[idN] = seance - with open('index', 'wb') as index: - pickler = pickle.Pickler(index) - pickler.dump(dicIndex) - pickler.dump(i) - with open('filmsCode', 'wb') as fichier: - mon_pickler = pickle.Pickler(fichier) - mon_pickler.dump(dicFilms) + if not(ind) : + with open('index', 'wb') as index: + pickler = pickle.Pickler(index) + pickler.dump(dicIndex) + pickler.dump(i) + if not(dic): + with open('filmsCode', 'wb') as fichier: + mon_pickler = pickle.Pickler(fichier) + mon_pickler.dump(dicFilms) return seance def getIndex(): diff --git a/filmsCode2 b/filmsCode2 new file mode 100644 index 0000000000000000000000000000000000000000..dc5d884af97d3a8d0d89c7db9afc547caf4bf9b4 GIT binary patch literal 1023 zcmY*Y+invv5KVznXt|U^xnG7`TST%=Kv05&5CS0}1%W7%Ur^=j4z-KdUf&vmgam)W zWBUm_=f@Zugv7({+OucQoH=8E-~Y|FR@mWIt5umYuE$cMohmmsYcBQX=Ike_>RG$* z)(=a-11oGg0i#2-(`=5`z3yG8rH%o;J(wd7xssj-jLy!m1;RXWf$#9I6}&}-rI1|P zL+n5zB9uMM7HL^?S4rq~!IZ%a9m1V%Z_UnTSi{HO&ap$8s-Em=l6WL<{aBmEOK*=d z`q{F_*nawGQ`_V08m-pRgXhv4?O_StnE2-th~LY}ZmH1Dvnc{fdt$JZlV$bBE{G{M zLs4F)F1$VY(VohIv56rL(JqQ(d0(2SQlF=@FVDI1XwT#|*P1*!%jSuu*I&EWhF<@E zKfNE^wddk6gOn+Gu;)dx_rf=OaYanCSxV@4|9N^z%w$&wvW9`|RPi&|%i=%J*8cbG zikM@kh~%kplRbng!uwdY;T3O;wjhqOZEARfW5*L0cMa-*pvWi}={5NYwF#zxmkJa) z=ZS&BjWfQ%GLV5jx(siO+|pFR695|Hh$SKE+$6gTco(^@Kq_#!BdG}3h>9K$+lEX9 z-nhxGZzlweC;*)|FA21aDyboo0M%sAqYJ4@Ry2l&#y{Cj1LVpO3kK@Gj159bNlIe; z0#XY;l$1s6p3~^Jc~S+AWWX49j6zqy2c3od5wJ|f1E<1JrG%*QZzCkjCmYS=7bvrZ zWTx&26L~v>K4D!as0xmHNWg}>q@7|;7DWN}syLp9x}Jv3rK5{-O`I4kiv@9BoMcNh zDp*G%#;CVCV>CJq3*iM~8wMkydNGclsiwUy7TIlrix3+BaCLPw8Wn#}WKo)Wb;Ls{ o9`8KT&(yQ=Yt`x3U3){E&Ua{orfYACvw3r;+r4L(;xHD!0Y-m4b^rhX literal 0 HcmV?d00001