IRC log of #zope3-dev for Friday, 2005-02-11

*** srichter has quit IRC00:10
*** Aiste has quit IRC00:13
*** Aiste has joined #zope3-dev00:18
*** [apoirier] has quit IRC00:20
*** PalmTree has quit IRC00:30
*** hazmat has quit IRC00:33
*** hazmat has joined #zope3-dev00:34
*** J1m has quit IRC01:58
*** niemeyer has quit IRC02:03
*** srichter has joined #zope3-dev03:04
*** ChanServ sets mode: +o srichter03:05
*** lodragan has joined #zope3-dev03:08
*** philiKON has quit IRC03:17
lodraganhilo03:19
*** projekt01 has quit IRC04:51
*** hazmat has quit IRC04:55
*** sashav has joined #zope3-dev06:15
*** lodragan has left #zope3-dev06:20
*** `anthony has quit IRC06:59
*** hazmat has joined #zope3-dev07:04
*** hazmat has quit IRC07:04
*** sashav has quit IRC07:32
*** `anthony has joined #zope3-dev07:33
*** zagy has joined #zope3-dev08:48
*** SteveA has joined #zope3-dev08:52
*** stub has joined #zope3-dev08:54
*** vinsci has quit IRC08:58
*** sashav has joined #zope3-dev09:00
*** zagy has quit IRC09:07
*** stub has quit IRC09:13
*** stub has joined #zope3-dev09:24
*** zagy has joined #zope3-dev09:24
*** d2m has quit IRC09:30
zagymoin09:31
SteveAciao09:47
zagyhi SteveA :)09:55
*** `anthony has quit IRC10:27
*** jproby has joined #zope3-dev10:39
*** vinsci has joined #zope3-dev10:49
*** vinsci has joined #zope3-dev10:49
*** Aiste has quit IRC10:51
*** MalcolmC has joined #zope3-dev11:46
*** vlado has joined #zope3-dev11:57
*** jproby has left #zope3-dev11:59
*** jproby has joined #zope3-dev12:10
*** mgedmin has joined #zope3-dev12:48
*** jproby has left #zope3-dev13:07
*** regebro has joined #zope3-dev13:08
*** philiKON has joined #zope3-dev13:10
*** d2m has joined #zope3-dev13:50
*** stub has quit IRC13:56
*** stub has joined #zope3-dev13:57
*** gintas has joined #zope3-dev14:16
*** `anthony has joined #zope3-dev14:24
*** niemeyer has joined #zope3-dev14:50
*** srichter has quit IRC14:51
*** Aiste has joined #zope3-dev14:55
mgedmindoes the anonymous svn repo lag behind the read-write one?15:05
philiKONuh, i don't think it should15:06
mgedminno it doesn't15:06
mgedminmust be a stale .pyc file15:06
mgedmin(I got a spurious DeprecationWarning in _field.py)15:07
mgedminuse-commit-times in ~/.subversion/config is contraindicated15:10
philiKONmgedmin, what do you mean?15:12
mgedminif you say use-commit-times = yes in that config file15:13
mgedminthen when you run svn co/svn up/svn revert15:13
mgedminsubversion sets mtime of files it modifies to the time of the commit15:13
mgedminwhich is all very nice15:13
philiKONok15:13
mgedminbut if you have a .pyc file with mtime greater than the commit time15:13
mgedminand run svn update15:13
mgedminpython will not notice that the file was changed15:14
mgedminand will not recompile the .pyc15:14
philiKONaah15:14
philiKONmakes sense15:14
mgedmin(I had turned that option on because pyblosxom need stable mtimes, and I keep my blog in subversion)15:15
*** danika has joined #zope3-dev15:30
*** srichter has joined #zope3-dev15:39
*** ChanServ sets mode: +o srichter15:46
*** danika has quit IRC15:50
*** sashav has quit IRC16:36
*** J1m has joined #zope3-dev17:36
*** bradb has joined #zope3-dev17:37
*** Aiste has quit IRC17:42
*** mgedmin has quit IRC17:45
J1mHey folks17:52
J1mIn the past, I suggested that implements and adapts could also be used as decorators outside of classes.17:53
J1mI looked at this last night and ran into a problem.17:53
SteveAdecorators?17:54
SteveAoh, like, to state that some class elsewhere implements something17:54
J1mWe said that these would work only in a class statement or in a global context (locals is globals), but I have a case where I want to declare the interfaces implemented by a comuted factory17:54
J1mdecorators in the Python 2.4 sense17:54
J1mas in:17:54
J1m@implements(I)17:54
J1mdef foo(): ...17:55
SteveAoh, those17:55
SteveAi'm not using 2.4 in production yet because it is not in the ubuntu stable distro release17:55
J1mI think the idea of having these functions used the way they are now and as decorators is too fragile.17:55
SteveAmy sysadmin said "no."17:55
vladofyi, pje has decorators for 2.317:55
J1mI think we need separate functions.17:55
SteveAvlado: written inside the class suite?17:56
J1mI want these functions to be usable as decorators in 2.4, even though we'll have to use an ickier syntax for now.17:56
SteveAJ1m: trouble picking up the context magically by looking at the stack of frames?17:56
J1mI think it's just too magic.17:57
J1mI want to be able to use these in cases where globals() is not locals()17:57
SteveAlike, classes defined inside a function17:57
SteveAor in a doctest ?17:57
J1mso the only way to know if we're in a class definition is to look for __module__.17:57
J1mNo, as in a function that computes a factory17:58
vladoSteveA, class suite ?17:58
J1mThe factory isn't a class.17:58
SteveAvlado: indented inside a class statement.17:58
SteveAJ1m: okay, i follow.17:58
J1mAlso, standard decorators like classmethod and staticmethod are nouns.17:59
J1mSo, I suggest "implementor" and "adapter", as in:17:59
J1mdef foo(): ...17:59
J1mimplementor(I)(foo)17:59
J1m17:59
J1min Python 2.4:17:59
J1m@implementor(I)18:00
J1mdef foo(): ..18:00
J1m18:00
philiKONwell, the most common usecase would still be aclass, right?18:00
philiKON@implementor(IFile)18:00
J1mNo18:00
philiKONclass File18:00
philiKONno?18:00
*** bradb has quit IRC18:00
J1mwell, first, Python doesn't have class decorators yet.18:00
J1mSecond, I find:18:01
J1mclass File:18:01
J1m    implements(IFile)18:01
J1m18:01
J1mmore readable.18:01
philiKONsame here18:01
vladoSteveA,18:01
vlado    """Use Python 2.4 decorators w/Python 2.2+18:01
vlado    Example:18:01
vlado        import dispatch18:01
J1mThis is really for the increasingly important case of factories that are not classes.18:01
vlado        class Foo(object):18:01
vlado            [dispatch.as(classmethod)]18:01
vlado            def something(cls,etc):18:01
vlado                \"""This is a classmethod\"""18:01
vlado    """18:01
J1mOr for subscribers.18:01
SteveAvlado: okay. thanks18:02
philiKONah, right, foo would just be a factory, it'd "implement" something because stuff that it pops out provides it18:02
J1mOr even:18:02
J1m@handler(IFile, IObjectModifiedEvent)18:03
srichteryes, this is also very important for documentation18:03
J1mdef do_x_when_file_modified(file, event): ...18:03
SteveAnot @handlor? ;-)  for consistency with @implementor18:03
philiKONJ1m, that's the equivalent of adapts()?18:03
J1mphiliKON, not quite. It would also somehow note that we don't return anything.18:04
J1mWe do all of the work in the call.18:04
philiKONah, ok18:04
philiKONbtw, does adapts() already support multiadapters?18:04
J1mSteveA, do you have an alternate spelling of implementor? Did I spell it wrong?18:04
SteveAI don't see why it is hard to disambiguate between use of implements() in an class suite and use of implements() as a decorator.  The result of the former is not called, the result of the latter is.18:05
J1mphiliKON, Of course18:05
SteveAJ1m: I always get confused between implementer/implementor and similar cases.  I've seen docs that confuse adapter/adaptor.18:05
J1mSteveA, then interface specifications (or at least implements specifications) would have to be called.18:05
J1mThey can't really do anything when they aren't called.18:05
J1mSteveA, then interface specifications (or at least implements specifications) would have to be callable.18:06
J1mIt still feels very brittle to me.18:06
philiKON+1 for keeping implements and implementor separate things18:06
J1mPlus, in the in-class case, they have to do the advice magic, which stuffs a __metaclass__ into locals.18:06
philiKONone is a decorator, one mangles with f_local and what not18:06
SteveAphiliKON: your arguments are compelling thinking from the point of view of someone who implements these things.  I'm not so sure they are valid from the point fo view of a user of these things.18:07
J1mI think it's clearer from the user's point of view too.18:07
SteveAthat's the argument that counts for me18:08
J1mYou'd have a single name that would have two extremely different usages.18:08
philiKONSteveA, i didn't tell you what my arguments were18:08
philiKON:)18:08
J1mThe user might see:18:08
J1m18:08
J1mdef foo():18:08
J1m    ...18:08
SteveAphiliKON: okay, you can buy me a beer at EP2005 and tell me all your arguments ;-)18:08
J1mimplements(I)(foo)18:08
J1m18:08
J1mand18:08
philiKONSteveA, hehe :)... if i ever make it to EP200518:09
J1m18:09
J1mclass Foo:18:09
J1m    implements(IFoo)18:09
J1m18:09
SteveA@implementing(IFoo) ; def foo(...)18:09
J1mand somehow understand why these two usages are different.18:09
SteveA@implement(IFoo) ; def foo(...)  # PEP-257 style imperative language18:09
J1mAlso, note that:18:10
J1m@implementor(I)18:10
J1mclass X: ...18:10
J1m18:10
J1mwould be equivalent to:18:10
J1m18:10
J1mclass X: ...18:11
J1mclassImplementsOnly(I)18:11
J1m18:11
philiKONbtw, i'm wondering (i don't know enough of that majyck going on in implements()), why can't we say:18:11
philiKONdef foo():18:11
philiKON  implements(I)18:11
philiKON?18:11
J1mBecause:18:11
SteveAJ1m: why?18:11
SteveAJ1m: why the classImplementsOnly(I) ?18:12
J1m1. The foo suite is executed at foo usage time, not foo definition time18:12
philiKONah, right18:12
J1m2, Python doesn't let is introspect function innards without far deeper voodoo than I'm willing to consider.18:12
J1mSteveA, because I think this thing should have the same semantics for classes as for functions and other factiries.18:13
SteveAdictionary.reference.com says implementor and implementer are equivalent18:13
philiKONso maybe they shoudl be aliases to the same thing?18:13
SteveAbytecodehacks!18:13
J1mHm, I dodn't realize that implementer was a word18:13
SteveAOOTDI18:14
SteveAhttp://dictionary.reference.com/search?q=implementor18:14
J1mphiliKON, no, because decorators have a different syntax.18:14
philiKONi meant implementer and implementor18:14
philiKONnot implementor and implements18:14
philiKONi see SteveA's point about people mixing -or and -er endings for implementor, adaptor, etc. etc.18:15
philiKONthough zope.component and the rest of z3 has definitely chosen adapter, so we might as well chose one of the others for real18:15
J1mdictionary.reference.com doesn't have an entry for implementer.18:15
SteveAJ1m: why is following inheritence for implementor for classes a problem for use in functions, where there is no inheritence?  sounds like standard liskov substitutable polymorphic behaviour to me.18:16
SteveA... if you consider classes to be a specialized kind of factory18:16
SteveAJ1m: metioned at the bottom of the implementor page18:16
J1mI see that, but it still doesn't have an entry.18:17
SteveAi just asked someone here18:17
SteveAhe spelled it "implementor" as a first guess.  google's spelling suggester (suggestor) suggests implementer18:18
J1mBut both emacs and mozilla consider implementer to be correct spellings. :)18:18
SteveAfarm, farmer, farmor18:18
SteveAarm, armer, armor18:18
J1mI'm OK with implementer18:18
SteveAin british, it might have to be implementour ;-)18:18
philiKONlol18:18
SteveAas armor is armour, color is colour18:19
philiKONi still write like that. that's the way i learned it in school here :)18:19
J1mOK, so, I'll let implementer(I)(cls) === classImplements(cls, I)18:20
SteveAJ1m: I like the sound of imperatives:  implement(I), handle(...), report(...), confess(...)18:20
SteveAalthough implement() is a bit close to implements()18:20
philiKONSteveA, but a) no nouns and b) implement() and adapt() look a lot like implements() and adapts()18:20
SteveAand i dislike too-closely-similar things18:20
philiKONright18:20
SteveAphiliKON: it isn't used as a noun.  "You!  Implement this!"18:21
J1mI do too, but I think we need different names and Python *does* use nouns for it's decorators.18:21
philiKONSteveA, right, that was the point. all decorators so far are nouns18:21
SteveAokay18:21
*** mooded has joined #zope3-dev18:21
SteveAif only guido was a linguist like larry wall.18:22
SteveA;-)18:22
J1mOK, I'll go ahead and do implementer and adapter, which will work as decoraters in 2.4.18:22
J1m:)18:22
SteveAokay18:22
philiKONboth importable from the samel ocation as implements() and adapts(), respecively?18:22
SteveAcan we have adaptee() for use on interfaces?18:22
J1myes18:22
philiKONlol18:22
philiKONimplementee()18:22
SteveAhandlee18:23
SteveAthis is getting sillee18:23
SteveAand I have more specs to review.18:23
SteveAthanks folks.18:23
* philiKON returns back to electrodynamics18:23
* J1m goes if to implement this.18:24
SteveA(if only guido was a linguist like adele goldburg)18:26
J1m:)18:28
srichterJ1m: I have a tricky case of BBB18:30
J1mok18:30
srichterJ1m: our ServiceManagerContainer has an attribute called __sm18:30
srichterNow, I renamed ServiceManagerContainer to SiteManagerContainer18:30
srichterand it will not find __sm anymore18:30
srichterthis is because18:30
srichter__sm got stored as _ServiceManagerContainer__sm18:31
J1mYes another reason why Python got private attributes wrong. :(18:31
srichterand now this variable is called _SiteManagerContainer__sm18:31
J1mOK, fro now on, no more __.18:31
srichterso, what's best approach? have a custom __setstate__ method?18:32
J1mIt would be nice if someone added this to the style guide.18:32
J1mNo18:32
srichterwhat then? make it a property?18:32
J1mI would create a *read* descriptor for it that tries to get it via the old name.18:33
philiKONwhy not a database evolvement script so that old databases will always work in the future, even if that BBB is removed some day18:33
srichterI can't18:33
srichterbecause Zope will not even start up18:33
J1mphiliKON, he needs that too.18:33
philiKONok18:34
J1mYou need an evolution script to fix this, but you also need to make it work without the script.18:34
srichtera lot of code expects the root folder to have a site manager right away18:34
srichterright18:34
J1msrichter, Use zope.cachedescriptors.property.Lazy18:35
*** gintas has quit IRC18:35
J1mRead descrs have the nice property that they are overridden by instance attrs18:35
J1m(no pun indented ;)18:35
srichterok18:36
srichterhow do LAzy properties work?18:36
J1mRead the documentation. :)18:37
srichter__sm = Lazy(lambda x: x._ServiceManageContainer, '__sm')18:37
srichter?18:37
srichteroh, I see18:38
srichteractually, I will not need an evolve script for this18:42
srichterthe lazy property does the necessary work18:42
philiKONbut then we'll have to keep that code in there until the dawn of mankind18:43
srichternope18:43
srichterlazy property automatically sets the value after the first lookup18:43
philiKONah, nice18:43
J1mHm, I'd forgotten about that. :)18:44
J1mYou still want the evolution.18:44
srichterand all site managers are called by all other evolve scripts before, so they all have been converted18:44
J1mah18:44
J1mk18:44
J1mso you will have evolution, for free.18:44
srichteryes :-)18:44
philiKONquestion is, why don't we use this opportunity and get rid of the __ attribute alltogether18:44
philiKONand make it _sm18:45
philiKONor something like that18:45
J1mGood point.18:45
srichteryou do that :-) my goal is to get Zope runnoing with old DBs now and merge my branch18:45
srichterI want to take the path of least resistence for now18:45
J1mEspecially since I just gave an edict that we wouldn't use private underwere anymore. ;)18:45
srichterI am getting very tired of this project18:45
srichter:-)18:45
philiKONUmm, would it be so much harder making the new property _sm than __sm?18:46
srichterprobably not; I am just not taking the chance that soemthing weird is going to happen18:47
philiKONi sure like to do it, but i'm having big exams coming up; i shouldn't even be wasting brain cells on zope right now ;)18:48
srichterokay, okay, I did ot18:48
srichteryeah, E&M sucks! :-)18:48
philiKONyou're my hero :)18:48
philiKONgot oral exams (vordiplom) coming up in ExpPhy and TheoPhy18:48
srichterI see18:48
srichterit's so different in Germany18:49
srichterhere everything is sorted by area18:49
philiKONhmm18:49
philiKONwell, the whole carreer is different, with bachelor/master and all that18:50
philiKONbut we'll be getting that in 2-3 years i think18:50
philiKONi still like the old system18:50
srichterJ1m: ok, so now I passed the initial hurdle, but now I get some TypeError18:51
srichterTypeError: Cache values must be persistent objects.18:52
srichterphiliKON: the old system totally isolates Germany from the rest of the world; and Germany is not the leading nation in science anymore (I think partially because of this), so they cannot afford to be different18:53
* J1m wonders if srichter is going to provide more context than that18:53
srichterJ1m: ok18:53
philiKONsrichter, that's the only reason i support the switch to the new system. that doesn't mean that I have to *like* it better than the old18:54
srichter    utils = [reg for reg in sm.utilities.registrations()18:54
srichter  File "/opt/zope/Zope3/Zope3-CA/src/ZODB/Connection.py", line 814, in setstate18:54
srichter    self._setstate(obj)18:54
srichter  File "/opt/zope/Zope3/Zope3-CA/src/ZODB/Connection.py", line 868, in _setstate18:54
srichter    self._reader.setGhostState(obj, p)18:54
srichter  File "/opt/zope/Zope3/Zope3-CA/src/ZODB/serialize.py", line 407, in setGhostState18:54
srichter    state = self.getState(pickle)18:54
srichter  File "/opt/zope/Zope3/Zope3-CA/src/ZODB/serialize.py", line 400, in getState18:54
srichter    return unpickler.load()18:54
srichter  File "/opt/zope/Zope3/Zope3-CA/src/ZODB/serialize.py", line 485, in _persistent_load18:54
srichter    self._cache[oid] = obj18:54
srichterTypeError: Cache values must be persistent objects.18:54
srichterthe only weird thing there is that sm is now retrieved using this lazy property, but I still do not see how this causes problems18:55
srichteroh, I think I know18:55
srichterthis might still be an SM of the old kind; I guess that sm.utilitites is tried to be pickled and can't be18:55
J1mThere error message indicates an object that used to be persistent, but isn't anymore.18:56
J1mThe error message indicates an object that used to be persistent, but isn't anymore.18:56
srichterahh, ok18:56
srichtermmh, there are plenty of candidates18:57
J1mUse your friend18:57
srichteryep18:58
*** Aiste has joined #zope3-dev19:00
J1msigh19:03
J1mI'm blocked by the freeze19:03
J1msrichter, when will we be thawed?19:03
*** mgedmin has joined #zope3-dev19:04
srichterIt depends on the obstacles19:05
srichterbut I think I will just get this database I have working and throw it out there19:05
J1mAn indefinite freeze is unsat19:05
srichterI can remove the last XXXs after the merge19:05
srichterso I hope I will finish over the weekend19:05
srichterJ1m: you can always make the change in the trunk and the branch19:06
srichterthen I don't care what you change19:06
J1mHow would it help to make the change on the branch?19:06
J1mGenerally it19:07
srichterbecause I do not have to worry about correct merges19:07
J1mGenerally it's a bad idea to make a change both on a branch and on the trunk.19:07
srichterand with conflicts I can just use the working version19:07
J1mMerging is usually harder with duplicate changes.19:07
srichterusually, not here :-)19:07
srichterI agree though19:08
philiKONsrichter, i don't think J1m addinig something (not modifying) shouldn't affect your work on the branch nor your merging19:08
J1mCan I just delete a test assertion from a test in zope.app.component.tests.test_factory?19:08
srichterbut because the diff utilities break down I have no reliable merges anmore19:08
srichterwith the last sync I had to go through each revision manually and make sure it worked19:08
srichtersure I think I can handle that19:09
J1mk, thanks19:09
srichterphiliKON: adding is bad too19:09
srichtera bunch of stuff has moved so even additions hurt (badly)19:10
J1msrichter, I was mistaken19:25
*** tvon has joined #zope3-dev19:26
J1mimplementedBy will now always suceed for callables.19:26
srichterJ1m: oh, for above; ok19:26
J1mI want to remove the feature from zope.component.factory that tries to support objects for which implementedBy fails.19:26
J1mSince it will no longer fail for a callable.19:27
srichteroh, I see19:27
J1mSo I'm removing that feature and it's tests.19:27
srichterok19:27
*** vlado has quit IRC19:28
srichterdarn this sucks19:28
srichterso old instances of the site manager do not have a utilitities attribute19:28
srichterso sm.utiltities fails19:28
srichterbut instead of a attribute error I get this TypeError about cached values19:29
srichterso I added a lazy property to provide this attribute and still no luck19:29
*** alga has joined #zope3-dev19:30
srichterI am wondering if I should try to convert old SMs at all and just store them in a temp variable until the evolve script is applied; at this point I will copy all the data19:31
srichterJ1m: when an object is loaded from a pickle, is __init__ called? (I would say no)19:32
mgedminsrichter, no19:33
srichteryeah, so now the question is why the persistence framework has a state for this attribute (or thinks it does)19:35
srichtereven worse, it makes my Python stop without recovery of the prompt19:36
J1mHas a state for what attribute?19:37
mgedmincould it be a class attribute?19:37
J1mI don't know what you are saying.19:37
srichtermgedmin: no, I checked19:38
srichterJ1m: well, the ZODB thinks it has a state for sm.utilities19:39
srichterbut this is impossible19:39
* mgedmin sometimes dreams about a through-the-web zodb object inspector that would show contents of pickles with hyperlinks to other persistent objects19:39
mgedminsrichter, you said something about a lazy property19:39
mgedminproperties are class attributes19:40
mgedminor does zodb try to assign something to a read-only property?19:40
srichteryeah, but I added those lazy properties after the error already occured (as a possible fix)19:40
J1mWhat do you mean "it has a state for sm.utilities"?19:43
srichterwell, it seems the ZODB tries to load the attribute 'utilitities' from the pickle19:44
srichteroh, I see now19:45
srichterit actually finds something else19:45
srichterso apparently, once you try to access an objcet's attribute it tries to load them all19:45
*** MalcolmC has quit IRC19:45
J1myes19:45
*** benji_york has joined #zope3-dev19:45
J1mIt tries to change state from "ghost" to "saved"19:45
srichterso in this case the RegistrationStack was among them which in my version was not persistent of course19:45
srichterI see19:46
*** J1m is now known as J1m|lunch19:46
*** bskahan has joined #zope3-dev19:51
*** J1m|lunch is now known as J1m20:03
srichterI HATE PRIVATE ATTRIBUTES!!!!!!!!!!!!!!! ARG20:08
philiKONlet's not give srichter Guido's home address, people might get hurt ...20:10
srichter:-)20:10
srichterLazy properties rectify this a bit (but jsut a little tiny bit ;-)20:10
srichterI hope I will make better progress once Zope starts up with an old database20:11
*** regebro has quit IRC20:35
srichteryes, Zope starts! :-)20:45
*** mooded has quit IRC20:47
*** Aiste has quit IRC21:22
Vobliai was playing with locale.date.formatter and og this stuff:21:25
Vobliahttp://www.mif.vu.lt/~igmi1451/test.txt21:25
Vobliashould the default locale work this way ?21:26
VobliaI mean u'1' does not look like "Sun" to me ...21:26
philiKONquestion is what TestRequest.locale really is21:27
Vobliawell i would assume that it uses "C"21:28
philiKONrequest.locale != system locale21:28
philiKONmy guess is that TestRequest.locale is some stub locale21:28
philiKONthat doesn't provide any useful data for the locale formatters from zope.i18n.locales21:29
VobliaI see21:30
mgedminI think deliberately providing misleading data is a bug21:31
Vobliaand how one could provide a sensible locale21:31
Vobliafor testing purposes21:31
philiKONVoblia, i would look at how zope.publisher does it21:31
philiKONmgedmin, what are you suggesting?21:31
mgedminsensible data in the stub locale21:32
philiKONVoblia, it must have some fall-back locale and it must somehow get a hold of the locale objects from zope.i18n.locale21:32
philiKONmgedmin, fair enough. sounds like a cool project for Voblia, eh ;)21:32
srichter1 == Sun in the default locale21:32
srichterbecause the default locale is based on the US locale21:32
srichterit is also not misleading, it is just the default ICU decided to have21:33
philiKONwhat's the formatstring "E" anyway? weekday?21:33
mgedmineek!21:33
srichterphiliKON: Can't remember, but I am pretty sure it is documented in zope.i18n.locales.formatter21:34
mgedminif it is based on the US locale, why doesn't it say "Sun"?21:34
philiKONclj.d21:34
philiKONerr21:34
philiKONhomerow21:34
Vobliasrichter, if you would take a look at the text file then you get '7' twice and u'1' after that21:34
philiKONcouldn't it be that the formatting strings are just applied wrong?21:35
srichtermgedmin: no, the code 1 stands for Sunday21:35
philiKONi mean, i've never seen this multiple "E" thingy21:35
srichterif you ask the formatter to display EEE you get "Sun"21:35
* philiKON only knows the regular strftime() notation21:35
philiKONsrichter, apparently you don't (see textfile)21:35
srichterphiliKON: it is the ICU notation that is also used commonly in spreadsheet applications such as Excel, ....21:36
philiKONhmm, ok... i thought spreadsheets use ####21:36
philiKONbut whatever21:36
mgedminsrichter, did you look at http://www.mif.vu.lt/~igmi1451/test.txt ?21:36
mgedmin"E" returns 7, "EEE" returns 121:36
mgedminfor the same date21:36
srichterthat's bad21:36
srichterthis is a bug21:36
* mgedmin whishes Voblia's snipped included all the imports21:37
srichter        ('E', 1): str(weekday),21:37
srichter        ('E', 2): "%.2i" %weekday,21:37
srichter        ('E', 3): calendar.days[weekday][1],21:37
srichter        ('E', 4): calendar.days[weekday][0],21:37
srichterso E should be 1, EE be 01, EEE be "Sun, and EEEE be "Sunday"21:38
srichterthis is from zope.i18n.format21:38
mgedminthat would be sensible21:38
srichterthis is definitely a bug21:39
srichterit seems that calendar.days does not return the right thing21:39
mgedminactually, "E" returns 7, not 121:39
*** mexiKON has joined #zope3-dev21:39
srichterlet me check the default locale though21:39
srichterhold on21:39
*** Voblia is now known as Awayblia21:40
srichterok, so the default locale has "1" for "EEE" and "EEEE"21:40
srichterso I am not sure where the 7 comes from21:40
srichtereek, and "E" and "EE" should be 1, if it really uses the root locale21:41
srichteroh, this is clearly a bug in the formatting code21:42
srichterit does not take the "firstDay" element setting into account21:42
mgedmindoes this mean that in real life, if the browser does not send an Accept-Language header, weekdays will be displayed as numbers?21:44
srichteryes, because then the browser does not know what language you have21:44
mexiKONif you use that formatting code, i guess21:44
mexiKONi've never had a problem with other formatting options21:44
srichterof course you could change the adapter choosing the locale21:44
mgedminthen I do not want to use that formatting code21:44
mgedminever21:44
mexiKON:)21:44
mgedminhow do I know if Monday is 0 like in Python, 1 like it seems natural for me, or 2 like Zope 3's standard locale?21:45
mgedminif I am just a hapless user21:45
srichteryou can always make en the default instead21:45
mgedmindoes ICU require this?21:46
srichtermgedmin: it is not Zope 3, all of ICU and thus Java uses this standard21:46
* mgedmin is baffled21:46
srichterand that's only for your locale data21:46
mgedmin"Sun" etc. was good enough for the default C/POSIX locale21:46
*** philiKON has quit IRC21:46
mgedminperhaps there is a good reason to move to ambiguous numbers21:47
srichteryeah, because they were US centric21:47
mgedminI'd just like to know that reason21:47
srichterwell, Sunday is 1, iff the firstDay option is set to "sun"21:47
srichterICU locales never start counting at 021:47
srichtermgedmin: what is the Lithuanian locale shortcut?21:48
mgedminwhat do you mean by "locale shortcut"?21:49
srichterlt21:49
mgedminyes21:49
srichterso in lt.xml, the firstDay = "mon"21:49
srichterso for "lt" you have "sun" being the seventh day21:49
mgedminI'm not complaining about E/EE returning different numbers in different locales21:51
mgedminI was surprised that EEE/EEEE returns a number instead of a name in the default locale21:51
srichteryeah, but the really bad thing is that the numbers are different, which they should not21:52
mgedminuhh21:53
mgedmin>>> formatter.format(date(2004, 10, 31), "EEEE, DD MMMM YYYY")21:53
mgedmingives me an exception21:53
mgedminTypeError: coercing to Unicode: need string or buffer, tuple found21:53
srichtereek21:53
srichtercan someone please make a bug report to this effect21:54
srichterI'll check all failures and wrong doings out as soon as my branch is merged21:54
mgedminok21:55
srichterof course, feel free to check some of this stuff out yourself ;-)21:55
mgedminby the way, is there a locale-aware way to say things like "3rd Monday of a week"?22:01
mgedminformatter.format(..., "F EEEE") returns "3 2" with the default formatter, which should explain my initial amazement and confusion22:02
srichteryou mean 3rd Monday of a month, right?22:06
mgedminerr, yea22:06
srichtermhh, F seems to be about timezones22:07
srichterit is currently hardcoded to be 222:07
mgedmin"      F      day of week in month  (Number)          2 (2nd Wed in July)"22:07
mgedminthat's what IDateFormatter says22:07
srichterfor some reason I did not implement it22:08
mgedminerr, IDateTimeFormat22:08
srichterok, so this is right, but it is not implemented for some reason; I wonder why22:08
srichtersee zope.i18n.format, line 57622:08
mgedminyou're right, it always returns 222:08
srichtermmh, I guess the datetime object could not return that info to me22:09
srichterso we would have to write a small helper method22:09
* mgedmin blinks22:10
mgedmin      k      hour in day (1~24)    (Number)          2422:10
mgedmin      K      hour in am/pm (0~11)  (Number)          022:10
srichtersame for w and W22:10
mgedminshouldn't hour in day be 0~23 and hour in am/pm 1~12?22:10
mgedminI've never seen 00:00 AM22:10
srichterI am pretty sure I just copied this stright out of the specs22:11
srichterI agree totally though22:11
srichterI would not mind changing this behavior22:12
mgedminnever mind, h/H are like I said22:12
srichteroh, right22:12
srichtertotally forgot ;-)22:12
mgedmin>>> dtf.format(datetime(2004, 10, 31, 15, 42), 'h H k K')22:12
mgedmin'3 15 16 3'22:12
mgedmin16?22:12
mgedmin>>> dtf.format(datetime(2004, 10, 31, 3, 42), 'h H k K')22:12
mgedmin'3 3 4 3'22:12
mgedmin>>> dtf.format(datetime(2004, 10, 31, 12, 00), 'h H k K')22:12
mgedmin'12 12 13 0'22:12
mgedmin>>> dtf.format(datetime(2004, 10, 31, 00, 00), 'h H k K')22:12
mgedmin'12 0 1 0'22:12
mgedminI suppose 'k' and 'K' are also just stubs22:13
srichterthey are22:14
mgedminok, then I'm no longer surprised22:14
srichter:-)22:14
mgedminhere's the issue: http://zope.org/Collectors/Zope3-dev/36422:14
srichterdid you look at format.py?22:14
srichterthanks22:14
srichterit has a comment in front of all the stubs22:14
* mgedmin looking now22:15
srichterwe really need TZ support in Zope 3 and finish the date/time formatting code once and for all22:15
mgedmindo you know what needs to be done for date/time formatting apart from bugfixes and finishing those stubs?22:18
* mgedmin looks into doc/TODO.txt22:18
* mgedmin greps for TODO in zope/i18n22:18
srichterTZ support!22:18
srichteronce we can go from timezone number to timezone name and back we are all set22:19
mgedminThere's a TODO: implement this method in LocaleCalendar.isWeekend22:19
srichterwe basically need support for the following four formats: "+000", "+00:00", "UTC", and "Greenwich Time"22:20
mgedminalso I don't like the look of "TODO: tworks for gregorian only right now"22:20
srichterdo you have other calendars? :-)22:20
mgedminnot me22:20
mgedminbut the interface defined six or seven of them22:20
srichterI would be surprised if anyone did22:20
mgedminlook at ILocaleDates22:21
mgedmingregorian arabic chinese civil-arabic hebrew japanese thai-buddhist22:21
mgedminwhew22:21
srichterright22:21
srichterthe only difference is the year I think22:22
srichterthey compute them in different ways22:22
mgedminregarding timezones, where do you get the timezone database from?22:22
srichterbut I will wait until someone actually requests those, before I worry22:22
mgedminbundle pytz with Zope 3?22:22
srichterthat would be best22:22
srichtersince it uses the Olsen data, which is the defacto one to use22:23
srichterwe really should ask the pytz developer to contribute his code to the Zope 3 project22:23
srichterwell, it's stuart; he is already a contributer22:24
J1msrichter, how does the apidoc adapter listing for an interface manage to filter out views? :)22:27
srichter:-) it checks whether the last adapted object implements IRequest22:28
J1mwhy does it filter?22:30
srichterbecause I have not had a chance to redesign API doc since 3.022:33
srichteralso, I still think it is useful22:33
srichterbut the main point is that I did not want to work on API doc until all the services were gone22:34
srichterJ1m: the Lazy property is great for BBB22:47
*** niemeyer has quit IRC23:04
*** dman13 has joined #zope3-dev23:28
*** SteveA has quit IRC23:45
*** stub has quit IRC23:56

Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!