egv / zapys-maemo
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
c66e42c
zapys-maemo / cache.py
| ec0aeb97 » | egv | 2008-06-22 | 1 | #!/usr/bin/env python | |
| 2 | # -*- coding: UTF-8 -*- | ||||
| 3 | |||||
| 4 | import os | ||||
| 5 | |||||
| 6 | cache_dir = os.path.expanduser('~/.zapys/entries/') | ||||
| 7 | |||||
| 8 | if not os.path.isdir(cache_dir): | ||||
| 9 | os.makedirs(cache_dir) | ||||
| 10 | |||||
| 11 | def put(id, text): | ||||
| 12 | f = open(cache_dir+str(id)+'.text', 'w') | ||||
| 13 | f.write(text) | ||||
| 14 | f.close() | ||||
| 15 | |||||
| 16 | def get(id): | ||||
| 17 | return open(cache_dir+str(id)+'.text').read() | ||||
| 18 | |||||
| 19 | def get_temp(): | ||||
| 20 | return open(cache_dir+'entry.html', 'w') | ||||
| 21 | |||||
