Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0
Commit Graph

7 Commits

Author SHA1 Message Date
Øystein Ingmar Skartsæterhagen 9a733ef73a Improved handling of output to terminal and files.
New module file_io which takes care of this.  All output should go
through file_io.write, which encodes it using the appropriate
character encoding.  For output to a temporary file, use "with
file_io.tmpfile('name')".

Moved WorblehatException to new module exc, so all modules can access
it without importing worblehat.
2011-10-12 19:26:21 +00:00
Øystein Ingmar Skartsæterhagen bf188c99ae Hack for character encoding in communication with database.
Added encoding from unicode to str in execute_query, and wrote wrapper
functions with decoding for the cursor methods fetchone and fetchall.

This means that from now on, one should never call these methods
directly on cursor objects, but instead call execute_query, fetchone,
fetchall, fetchone_dict or fetchall_dict in util.py.

I plan to separate out this code to a new module (db.py?), and rewrite
it in a way that makes it harder to write things like c.execute by
mistake.
2011-10-11 15:16:07 +00:00
Øystein Ingmar Skartsæterhagen 87e0cdda9d New utility function execute_query, wrapping cursor.execute.
This is a hack to avoid a problem with using %(foo)d in a query with a
NULL value.
2011-10-08 19:20:21 +00:00
Øystein Ingmar Skartsæterhagen 44553732ca Fixed some bugs in write_tmpfile. 2011-10-08 18:10:10 +00:00
Øystein Ingmar Skartsæterhagen f39cbbe957 En ny util-funksjon. 2011-10-08 11:37:37 +00:00
Øystein Ingmar Skartsæterhagen 66d1ca3827 Fisket inn litt mer kode fra forrige inkarnasjon.
Har nå kommandolinjetolking, men implementasjonene av kommandoene er
tomme.
2011-10-08 10:13:32 +00:00
Øystein Ingmar Skartsæterhagen e0aa1d53d2 Såvidt begynt på nytt kommandolinjegrensesnitt.
* Kopiert inn noe dokumentasjon (filformat og kommandolinjeargumenter)
  fra forrige forsøk (som var i python-katalogen).

* Kopiert implementajonen av filformatet fra forrige forsøk.

* Kopiert nyttige ting fra mdboh, samt noe fra forrige inkarnasjon av
  kommandolinjegrensesnittet her, til util.py

* Skrevet litt testkode i worblehat.py.
2011-10-08 09:06:15 +00:00