Ø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
1f2c52bb47
Hacks for character encoding in fileformat.py.
...
I try to consistently translate strings to unicode objects when
reading, and encode all unicode objects when writing. But it is not
clear when the translation should happen. This module needs to be
cleaned up a little.
2011-10-11 15:44:17 +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
Péter Henrik Gombos
b50fe04b1f
utilized book search, work now as list just with where clauses
2011-10-09 18:56:19 +00:00
Péter Henrik Gombos
8c660ecaee
added some sql to search
2011-10-09 18:32:24 +00:00
Péter Henrik Gombos
cc4eadc885
fixed bug in referenceadding to books
2011-10-09 18:08:01 +00:00
Andreas Lindahl Flåten
e14ab5e580
added printing of filename in register-books
2011-10-09 17:57:30 +00:00
Andreas Lindahl Flåten
e71965048e
fixed commit bugs
2011-10-09 16:15:17 +00:00
Andreas Lindahl Flåten
09e2bc414d
Added 'register books' and made a list of book categories
2011-10-09 16:13:20 +00:00
Péter Henrik Gombos
5abde71f2e
now possible to give the orangutang bananas
2011-10-09 16:06:32 +00:00
Péter Henrik Gombos
9746e7d1f2
added reference adding for books
2011-10-09 15:36:08 +00:00
Andreas Lindahl Flåten
73b4c4f2e2
Added suggest-book-data command
2011-10-09 15:02:59 +00:00
Øystein Ingmar Skartsæterhagen
c614e4b06a
Improved reading in fileformat.py.
...
* Handles comments (lines starting with '#').
* Remembers line numbers, and uses them in error messages.
2011-10-09 14:39:07 +00:00
Øystein Ingmar Skartsæterhagen
066d3a4364
Improved list book command.
...
Wrote a better query, so I could remove much ugliness from the Python
code.
Added trimming of book titles that are too long.
2011-10-09 13:45:15 +00:00
Andreas Lindahl Flåten
6f840f1073
Fixed bug {22} where isbn was not correctly parsed
2011-10-09 13:32:11 +00:00
Øystein Ingmar Skartsæterhagen
6d112dd1c2
Reinserted some code that disappeared mysteriously.
2011-10-09 13:23:42 +00:00
Péter Henrik Gombos
d885f9a1d3
updated wrong field
2011-10-09 13:21:46 +00:00
Péter Henrik Gombos
469c4a4b41
added search-description to book search
2011-10-09 13:18:36 +00:00
Péter Henrik Gombos
4449493bbd
implemented search-person
2011-10-08 19:53:24 +00:00
Øystein Ingmar Skartsæterhagen
a9f1ac6a66
Fix in fileformat.py: Empty fields are None when reading.
2011-10-08 19:49:28 +00:00
Øystein Ingmar Skartsæterhagen
9e84d0cfcd
Ugly encoding hacks.
2011-10-08 19:41:57 +00:00
Péter Henrik Gombos
3c911d3131
developed book search with possibility for more than one word, and search for authors
2011-10-08 19:32:30 +00:00
Øystein Ingmar Skartsæterhagen
ba14cc09b6
Use execute_query in do_action to allow integer fields to be empty.
2011-10-08 19:20:51 +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
Andreas Lindahl Flåten
b34f8da82b
Fixed writing book/author suggestion to file, and made it prettier
2011-10-08 19:20:02 +00:00
Øystein Ingmar Skartsæterhagen
bd81dc4425
Implemented edit command.
2011-10-08 19:08:06 +00:00
Øystein Ingmar Skartsæterhagen
44553732ca
Fixed some bugs in write_tmpfile.
2011-10-08 18:10:10 +00:00
Andreas Lindahl Flåten
6cd76a205d
suggest_book now conceptually working, needs to look better
2011-10-08 17:11:34 +00:00
Øystein Ingmar Skartsæterhagen
2000445902
Fixed some errors in the implementation of the commit command.
2011-10-08 17:09:31 +00:00
Øystein Ingmar Skartsæterhagen
46a606c2bf
Fixed some errors in fileformat.py, and added some debugging code.
2011-10-08 17:08:46 +00:00
Øystein Ingmar Skartsæterhagen
cdaa0430d8
Set worblehat.py to be executable.
2011-10-08 16:13:14 +00:00
Øystein Ingmar Skartsæterhagen
445bf30450
Tried to implement commit command.
...
Haven't tested it much, so it is probably very buggy.
Also fixed an error in the show command (it died when asked to show
something that didn't exist).
2011-10-08 16:05:27 +00:00
Péter Henrik Gombos
1076b8ecaa
first implementation of search, with only one word
2011-10-08 15:20:50 +00:00
Øystein Ingmar Skartsæterhagen
14d98f3d57
Implementert visning av kategori.
2011-10-08 14:35:26 +00:00
Andreas Lindahl Flåten
d9f41d3e7e
Opprettet google_interface
...
google_interface.py inneholder funksjonalitet som svarer til kommandoen "worblehat suggest-book-data"
2011-10-08 14:08:15 +00:00
Øystein Ingmar Skartsæterhagen
b808517be3
Implementert 'list category'.
2011-10-08 13:58:32 +00:00
Øystein Ingmar Skartsæterhagen
d4ca8c5679
Endret noen feltnavn i fileformat.py for å stemme med resten.
2011-10-08 13:53:52 +00:00
Øystein Ingmar Skartsæterhagen
7650057992
Implementasjon av 'list person'.
2011-10-08 13:50:58 +00:00
Øystein Ingmar Skartsæterhagen
bf3d8f78a6
Implementert visning av person.
2011-10-08 13:27:03 +00:00
Øystein Ingmar Skartsæterhagen
7eb9967524
Fikset litt på visning av bøker. Får med personer knyttet til boken.
2011-10-08 12:22:40 +00:00
Øystein Ingmar Skartsæterhagen
6d50951cf0
Fikset en feil i show.
2011-10-08 11:40:43 +00:00
Øystein Ingmar Skartsæterhagen
dcb6982d24
Begynt å implementere kommandoene for å vise bøker.
2011-10-08 11:38:13 +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