Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/archivo.py
diff options
context:
space:
mode:
authorYader Velásquez <yajosev@gmail.com>2011-02-11 00:36:51 (GMT)
committer Yader Velásquez <yajosev@gmail.com>2011-02-11 00:36:51 (GMT)
commita843016ab52b06030d3cd85889b44564316500f0 (patch)
tree515f439de6ee00e43bc66a8713ed71c7ad518de2 /archivo.py
parent307971bb5757a88b368d31ba698fbf3851707ecd (diff)
new fuction for mark calendar
Diffstat (limited to 'archivo.py')
-rw-r--r--archivo.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/archivo.py b/archivo.py
index b913cfa..12a461a 100644
--- a/archivo.py
+++ b/archivo.py
@@ -135,23 +135,33 @@ def borrar_dato(indice, indice_lista, path):
f.flush()
f.close()
-def lista_meses(path):
+def dict_meses(path, fecha=None):
+ '''Create if not exists and return a data
+ dictionary with the months index'''
path = path + '/data/lista_dias.pkl'
+ if fecha is not None:
+ indice = fecha[:4]
+ fecha = int(fecha[4:])
- meses = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'ago', 'sep',
- 'oct', 'nov', 'dec']
-
if not os.path.exists(path):
_log.debug('THE FILE LISTA_DIAS DID NOT EXISTS')
f = open(path, 'wb')
datos = {}
- for i in meses:
- datos[i] = []
pickle.dump(datos, f)
else:
- f = open(path, 'rb + wb')
+ f = open(path, 'rb+wb')
datos = pickle.load(f)
+
+ if fecha is not None:
+ if indice in datos:
+ datos[indice] = lista_fechas.append(fecha)
+ else:
+ lista_fechas = []
+ lista_fechas.append(fecha)
+ datos[indice] = lista_fechas
+ pickle.dump(datos, f)
+
f.seek(0)
f.flush()
f.close()