2008-6-25
| 16:36 | korpios | Speaking about database backends ... I just posted a proposal to django-dev that the PostgreSQL backends stop paying attention to time zones, so we can properly support time zones. (Sounds counterintuitive, I know.) Thoughts from anyone? |
| 16:38 | lsoto | korpios: you mean passing it datetimes with tzinfo fields, and avoid calling "SET TIMEZONE"? |
| 16:39 | korpios | lsoto: The idea is that the time zone shouldn't be handled by Postgres (or any backend), since it only supports fixed offsets. A new Field (already written and working in our code) could support it by taking an argument of either a tzinfo instance, or a lookup to a string (e.g., "America/Chicago"), and always yield timezone-aware datetime instances |
| 16:40 | korpios | also, postgres's timezone handling is pretty damned broken, as it blows up the moment you change settings.TIME_ZONE or database backends |
| 16:41 | korpios | if we just use a plain TIMESTAMP (aka TIMESTAMP WITHOUT TIME ZONE) and stop using SET TIME ZONE on connections, the mentioned Field could handle everything cleanly |
| 16:41 | lsoto | korpios: but, if you give psycopg a datetime instance with a tzinfo field, isn't it saved properly (as a timestamp with timezone)? |
| 16:41 | korpios | lsoto: it saves a fixed offset, not the actual zone |
| 16:42 | lsoto | oh, crap |
| 16:42 | korpios | so you're left wondering, e.g., am I talking about Arizona, or DST Central (in America)? |
| 16:43 | jbaker_ | jacobkm, lsoto: re ctypes on jython, yes it's very possible. JNA is modeled on ctypes, but apparently PyPy has a portable solution they developed (to work with their java backend, other backends) that we plan to look at. so that will be one of the things that we will be looking at the EuroPython sprints |
| 16:43 | korpios | I have a DateTimeZoneField that you can pass in, e.g., time_zone='city__time_zone', and it'll look that relation, and use that string to set its own tzinfo |
| 16:43 | korpios | or you can just have the relation on the same model if the zone will always be changing (e.g., tracking a road trip) |
| 16:47 | jbaker_ | my experience (drawn from oracle) is that it's better not to use the TIMESTAMP WITH TIMEZONE; at least at some point, cx_oracle didn't properly support it; and worse, such columns could not participate in indexes |
| 16:48 | korpios | jbaker_: right ... if we don't use WITH TIME ZONE we can let a timezone-aware Field assume that the backend data is always in UTC |
| 16:49 | jbaker_ | right, better to normalize the timestamps to UTC, and manage for the user in some interesting way |
| 16:49 | jbaker_ | that only can be done at the app level anyway |
| 16:50 | korpios | I've got the "interesting way" down ... I just need the time zone references removed from postgres to make it sane (as it is, I need to throw an error if TIME_ZONE isn't UTC and the backend is postgres) |
| 16:51 | jbaker_ | that's definitely the right approach. similar to normalizing your unicode encoding to UTF-8 in the database - or comparable. (can't remember if sql server wants to do utf-16 or utf-8) |
| 16:52 | lsoto | jbaker_: cool, so I will implement such UTC normalization on the postgresql_zxjdbc backend |
| 16:52 | jbaker_ | sounds like a plan |
| 16:53 | empty | jbaker_: "Generally, SQL Server stores Unicode in the UCS-2 encoding scheme" |
| 16:56 | jbaker_ | this is getting a bit off-topic, but i think .Net has done the same ucs-2 -> utf-16 switch seen in java. for some reason, i developed some background in this ;), see jython. so it's likely that sqlserver at some version is doing the same, especially since the aspect of surrogates can be often be ignored by db level code |
| 16:57 | empty | jbaker_: well this is where I got that: http://msdn.microsoft.com/en-us/library/bb33096... |
| 16:57 | empty | I'll say no more on the sub |
| 17:01 | jbaker_ | empty: i wholeheartedly concur, just concluding that they at least support utf-16 where it's perhaps most important, in their xml support; and let you access CLR functions when you do care about surrogates |
| 17:01 | empty | yup |
| 17:23 | jezdez | hey guys, what do you think of #6398? |
| 17:24 | DjangoBot | |
| 17:25 | jacobkm | jezdez: OK idea, but as a new feature it'll probably have to be post-1.0 |
| 17:25 | jacobkm is going to be saying that a *lot* over the next few months :) | |
| 17:25 | jezdez cries | |
| 17:25 | jezdez | not really :P |
| 17:25 | jezdez | marking it post-1.0 |
| 18:30 | lsoto | looks like #7190 is breaking the test suite under mysql |
| 18:30 | DjangoBot | |
| 18:32 | lsoto | |
| 18:33 | lsoto | (I also get some failures related to collation: "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='") |
| 18:33 | lsoto | can someone confirm this? |
| 18:35 | Alex_Gaynor | lsoto: I think that's because BooleanField doesn't have the SubFieldBase metaclass which means that to_python isn't called |
| 18:35 | Alex_Gaynor | |
| 18:35 | Alex_Gaynor | Because that should ensure the correct coersion |
| 18:35 | Alex_Gaynor | |
| 18:36 | Alex_Gaynor | I might be wrong though |
| 18:38 | lsoto | wow, I was always asuming that to_python was being called on django builtin field types |
| 18:38 | lsoto | thanks for the tio |
| 18:38 | lsoto | *tip |
| 18:38 | lsoto | anyway, the current to_python doesn't consider the values 0 and 1 |
| 18:39 | Alex_Gaynor | Does adding the __metaclass__ and 0, 1 to the choices solve the problem? |
| 18:39 | Alex_Gaynor | (Maybe try just adding 0 and 1 first, in class to_python is being called) |
| 18:39 | lsoto | after reading the comments of #7190, I don't think so |
| 18:39 | DjangoBot | |
| 18:40 | lsoto | seems like it must be fixed on the mysql backend |
| 18:40 | lsoto | "Note: the approach in the mysql.patch attachment handles some cases that the approach in the boolfield.diff attachment does not: for example, the former fixes results returned by calling Model.objects.value()" |
| 18:40 | lsoto | IOW, __metaclass__ and (0, 1) won't fix the test failure |
| 18:51 | lsoto | jacobkm: I've confirmed that the serializer_regress test follows a code path which end with field values containing strings for TimeField |
| 18:51 | jacobkm | hm |
| 18:51 | lsoto | so I think that such string support is there for serializers too |
| 18:53 | lsoto | anyway, I won't break that, I think Honza is in a better position do whatever cleanup is needed as part of his model validation |
| 18:55 | lsoto now will test his changes against oracle | |
| 21:54 | ubernostrum | brosner: wha? |
| 21:55 | brosner | one second while i formulate this |
| 21:55 | ubernostrum | brosner: this better not be some sort of intervention. |
| 21:55 | ubernostrum | I swear I only used Perl that one time. |
| 21:55 | brosner | haha |
| 21:55 | ubernostrum | And she told me she was Ruby. |
| 21:57 | brosner | http://dpaste.com/59125/ won't work in newforms-admin. it works fine with a standard outside the admin form. i have tracked it down to RelatedFieldWidgetWrapper and the only thing that i *think* it might be is its __deepcopy__ method. firstly i dont understand what memo is? |
| 21:57 | Alex_Gaynor borrowed Learning Perl from the library once, he didn't get it | |
| 21:57 | brosner | RelatedFieldWidgetWrapper adds the nice add ability to fk in the admin fyi |
| 21:58 | brosner | it is at that point apparently storing a cached version of the queryset which i am not entirely sure how |
| 21:58 | ubernostrum | brosner: fuck if I know, I leave double-underscore methods to jkocherhans. |
| 21:58 | brosner | :) |
| 21:58 | ubernostrum pokes a bit anyway. | |
| 21:58 | Alex_Gaynor | jacobkm: Are all the unit tests and everything done? |
| 21:59 | jacobkm | Alex_Gaynor: for #2070, you mean? |
| 21:59 | DjangoBot | |
| 21:59 | Alex_Gaynor | Yeah |
| 22:00 | jacobkm | Alex_Gaynor: as much as I can, yeah... there's still a few code paths that are hard to test -- mostly because the test client actually gets in the way by helping too much. |
| 22:01 | jkocherhans | brosner: memo is passed around to track the objects that have already been copied IIRC |
| 22:02 | Alex_Gaynor | jacobkm: Ok, I got all confused when you removed the TODO, but there was no code up there :D |
| 22:02 | jacobkm | Alex_Gaynor: ha, yeah; I removed it because it's somewhere between hard and impossible. |
| 22:03 | jacobkm | The actual UploadHandler / UploadedFile classes get a good workout from the tests, but testing the parser is really difficult. |
| 22:03 | jacobkm | Though actually the one thing that *should* still be done is a few test cases involving custom upload handlers and adding/remving them on the fly. |
| 22:35 | telenieko | jacobkm: is my git diff screwed, or does you 2070 branch add a blank line in django/core/files/__init__.py ¿ |
| 22:36 | telenieko | s/you/your/ |
| 22:36 | jacobkm looks | |
| 22:36 | jacobkm | telenieko: yeah, silly, there's indeed a blank line there. I just killed it. |
| 22:37 | telenieko reviews diffs at a character level! hehe ;) | |
| 22:38 | jacobkm | I love the shit out of TextMate, but it has a habit of adding whitespace where I didn't expect it. |
| 22:38 | telenieko | jacobkm: on pulling, the way my published master is done now is fine or should I find a better way to make it easier to spot what I've done there? (git cherry -v does not seem very helpfull from this side) |
| 22:38 | telenieko | jacobkm: Use vim :P (now somebody will say "use emacs") |
| 22:39 | jacobkm | telenieko: it's pretty clear -- I'm using format-patch instead since I find it easier to review that way. |
| 22:39 | ubernostrum | telenieko: use vim inside of emacs. |
| 22:39 | telenieko | does it get which comes from me and what from merges of trunk? |
| 22:39 | jacobkm | telenieko: personally, I prefer single topic branches (all mine are named NNNN-some-label where NNNN is the Trac ticket number) but however you want to organize your repos is fine with me. |
| 22:40 | telenieko | jacobkm: I have topic branches, but used git merge --squash, I'll publish then from now on ;) |
| 22:40 | telenieko | ubernostrum: nice to know :)) |
| 22:41 | jacobkm | I'm still not *really* using git all that much, so don't expect me to do much from your repos really... I still find dealing with patches *far* easier. |
| 22:41 | jacobkm | telenieko: have you seen git-trac? |
| 22:41 | telenieko | jacobkm: yes, and I ended up setting up redmine, but I needed the multiple projects things |
| 22:41 | jacobkm | gotcha |