release number? (was: Christmas release? :))

Bernhard Herzog bh at intevation.de
Thu Dec 6 11:56:47 CET 2007


On Wednesday 05 December 2007 20:50, Bram de Greve wrote:
> I'm still not sure about returning the string data as unicode or as
> "raw" encoded strings.  You see, my interest in pyshapelib is beyond
> Thuban.

pyshapelib should definitely stay usable outside of Thuban.

> Of course, regardless of the choice, DBFTable in Model/table.py 
> should use Unicode.  But if pyshapelib returns raw strings, then
> DBFTable will do the conversion instead so that it blend seamlessly with
> the rest of Thuban.

From Thuban's point of view it's sufficient that the abstraction in table.py 
automatically translates between Thuban's internal encoding and whatever the 
underlying data sources use.

pyshapelib was primarily meant to be a python wrapper for shapelib.  As such 
it should be reasonably close to shapelib itself and reasonably compatible 
with older pyshapelib releases.  Automatic translation between unicode and 
the dbf file's encoding is not necessarily important in pyshapelib itself.  
However, unicode will be the preferred data type for text in Python 3 and 
builtin support for it is probably a good idea in pyshapelib.  At the same 
time, pyshapelib should provide access to all features of shapelib, so a way 
to get at the raw bytestrings might be important too.

> OTOH, I might do it in a configurable way.  For example: dbflib returns
> raw encoded strings by default, unless you do something like this:
>
> import dbflib
> dbflib.return_unicode = True
>
> or even individually on each file:
>
> dbf = dbflib.open(u"foobar", return_unicode=True)

The latter version is much better.  Such settings should not be globals in a 
library.

   Bernhard

-- 
Bernhard Herzog                              Intevation GmbH, Osnabrück
Amtsgericht Osnabrück, HR B 18998             http://www.intevation.de/
Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20071206/72a34d9b/attachment.bin


More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)