/srv/irclogs.ubuntu.com/2011/05/29/#launchpad-dev.txt

LPCIBotProject windmill-devel build #151: STILL FAILING in 1 hr 8 min: https://lpci.wedontsleep.org/job/windmill-devel/151/06:45
magciushow did you guys hack apart zope so that you wouldn't have to use ZODB^W pickle?09:07
wgrantmagcius: It basically just needs a custom publication class.09:08
wgrantI tried a similar thing in 2007 or so, and basically ended up copying the base publication and deleting ZODBish bits, and it worked fine.09:09
wgrantIt wasn't practical to inherit much of it.09:09
wgrantBecause ZODB is so ingrained.09:09
wgrantBut it didn't end up that big, and that was the only thing to which I had to make significant changes, IIRC.09:09
wgrantI09:09
wgrantI may still have a copy of it around somewhere.09:09
magciuszope hacker I'm talking to says that must "wreak havoc on security"09:09
wgrant... why?09:09
wgrantThe security machinery doesn't depend on ZODB :/09:10
wgrantThat would be very Zope, but it's not true :)09:10
magcius"because the ZODB allows per object access control"09:10
wgrantThat's got very little to do with ZODB.09:10
wgrantSecurity proxies work on Python objects.09:11
wgrantNot in the ZODB.09:11
magciuswgrant, can you point me to this code somewhere in LP?09:11
wgrantIt'll be in lib/canonical/launchpad/webapp somewhere.09:12
wgrantcanonical.launchpad.webapp.publication has our very custom publication.09:12
wgrantMay also need custom RequestPublicationFactories.09:15
wgrantI forget where they live.09:15
* wgrant greps.09:15
wgrantPossibly not.09:19
wgrantAnyway, the critical bit is getApplication on the publication.09:19
wgrantYou can see here it gets the ILaunchpadRoot utility.09:19
wgrantRather than taking the root from a ZODB.09:19
wgrantThere's also lovely.zetup which does ZODB and ZConfig removal, IIRC>09:20
wgrantBut it's been a while :)09:21
lifelesswgrant: magcius: the problem is that zopes entire programming model is based around aozdb10:13
lifelesswgrant: magcius: so we're *still* paying for this hack in terms of performance10:13
magciusheh10:13
magciusif you could "do it again" today, what would you do10:14
lifelesswell10:15
lifelesshttps://dev.launchpad.net/ArchitectureGuide/Services10:15
lifelesswe are doing it again :)10:15
lifelessmagcius: your zope hacker is right, it wreaks havoc10:17
lifelessmagcius: it works, but its terribly terribly slow unless we're careful to preload things10:17
lifelessmagcius: in terms of choosing an application stack, if we were setting out to do LP from scratch, I couldn't really say.10:19
magciusOK.10:19
magciusI'm getting into the scary world of web development here, and all the existing frameworks suck :(10:19
wgrantI don't like Django for this sort of thing.10:20
wgrantZope sucks, but it is semi-appropriate for what LP is.10:20
wgrantDjango is less appropriate IMO.10:20
lifelessI'd like to do something with http://liftweb.net/10:20
magciusHere's what I like about Zope: the security/auth system is a bit neato, and I do like the interface and adapter system10:27
lifelessmmm10:27
magciuseverything else? ZODB? meh.10:27
wgrantThe security stuff is awesome, but is really slow with SQL.10:27
lifelessso I don't value those at all10:28
magciuslifeless, I like that you have to define users and roles and what can access what.10:28
magciusso that we don't get another diaspora :D10:28
lifelessthey don't really fit in a hugely dynamic language like python10:28
magciusdo you mean the auth system or z.i?10:28
lifelessz.i.10:29
magciusI assume you've read glyph's infamous post?10:29
lifelessignoring some of the fugly globals based implementation details10:29
lifelessmagcius: I think I have10:30
magciusI just treat z.i as a better isinstance right now10:30
magciusbut not __subclasshook__. Because __subclasshook__ is all about trickery and deceit.10:30
magciuslifeless, http://glyph.twistedmatrix.com/2009/02/explaining-why-interfaces-are-great.html11:22
lifelessmagcius: yes, that one11:37
lifelessmagcius: basically, I think in python you want to embrace the duck11:38
magciusof course11:38
magciusz.i doesn't disallow or try to prevent that11:38
magciusbut there are sometimes when you have an A, and you want a B11:39
lifelessI argue that using z.i. shows a failure to embrace the duck.11:39
magciusadaptation is perfect for that11:39
lifelessits *a* solution.11:39
magciusother solutions are isinstance11:39
magciusbut isinstance is a bit closed... you have to modify the method if you want to add new types...11:39
lifelessisinstance, delegation, multimethods, type factories11:39
magciusetc etc.11:40
lifelessoffhand11:40
lifelessthere are probably other approaches too.11:40
magciusnever heard of any of the latter11:40
magciusto make isinstance extensible, they added ABCs and __subclasshook__11:40
lifelessyes11:40
lifelessthis was a bit myopic.11:40
magciuswhich allows you to lie: you can say you're a B, even though you just look almost like a B11:41
magciusto me, that's the wrong way of doing it11:41
lifelesshaving a problem with isinstance, they made it worse :)11:41
magciuswith z.i, you define what things you need in an interface, and then adaptation allows you to turn anything into what you need11:41
magciusinstead of lying11:41
lifelesssure, if you don't mind the costs11:42
lifelessand the inflexability11:42
lifelessI dislike the costs and find the inflexability more a burden than a benefit, most of the time.11:42
magciuswhat costs do you see?11:42
lifelessits a global registry11:43
lifelessyou run more code when importing your app11:43
lifelessYou have to double-define everything11:43
magciusdouble-define?11:43
lifelessclass IFoo(Interface): def foo():pass11:43
magciusyou don't have to do that, although you should for documentation.11:44
lifelessclass Foo(object): implements(IFoo); def foo(self): do stuff.11:44
magciusz.i won't check to make sure you're implementing everything11:44
magciusyou can just do class IFoo(Interface): pass if you want11:44
lifelessmagcius: you asked what the costs are.11:44
lifelessif you are writing in this style, this is something you do: its a cost.11:44
magciusOK, sure.11:44
lifelessmagcius: we use interfaces very extensively in LP; I'm quite familiar with the system.11:45
magciusRight.11:45
lifelessI'm not arguing against it from a position of ignorance :)11:45
magciusI wish there was something that provided adaptation as a language feature.11:45
lifelessOh, and I should add confusing-code to the list.11:46
magciusz.i code is extremely messy, z.c more so11:46
lifelessadaption is a poor way to write code, IMNSHO.11:46
lifelessi don't mean the implementation of z.i. is confusing : I mean that adaption centric code is confusing for readers.11:46
magciusif it was a Python language feature instead of ABCs, I would cheer.11:46
magciusbut yeah11:47
magciusadditionally, having to define roles and explicitly say "this is public" I like11:47
lifelessIf IFloat and IString existed, when would you use "%3.4f" % foo and when would you use IString(foo), if foo is a float ?11:47
magciusthose are dumb, though11:48
magciusIString isn't an interface.11:48
magciuswhat does it allow?11:48
magciusit would be ISequence or IMapping11:49
lifelesswell, it would extend ISequence,11:49
magciuswhat does IString add on top of ISequence?11:49
lifelessactually IImmutableSequence11:49
lifelessmagcius: replace, format, for starters11:50
lifelessmagcius: join11:50
magciusI would expect IString(float(foo)) to be implemented in terms of a simple adapter:11:51
magciusdef float_to_str(value): return str(value)11:51
lifelessthis demonstrates the point.11:52
lifelessThats approximately never the right way to convert a float to a string11:52
magciuswell sure11:52
lifelessso having an adapter is bogus11:52
magciusstr(float(value)) is as useless, though11:52
lifelessof course it is11:52
* magcius kicks XChat11:52
magcius^W in XChat is "close tab"11:53
magciusI have no idea why...11:53
magciusIf you're saying IString(foo) is stupid because str(foo) is stupid...11:54
magciusI don't see how this is an argument *against* interfaces or adaptation.11:54
magciuswe already do the same thing with duck typing -- we don't care what it is, we just want a string out of it11:55
magciusstr(foo) is the easy way to do this11:55
lifelesscast-based adaption is only useful when there is one and only one right way to get from A to B11:55
magciusof course.11:56
magciusfor most types, there usually is only one way11:56
lifelessI disagree there.11:57
lifelessPerhaps 50%. Perhaps.11:57
magciusif there's a difference, you need to define a new interface IMHO11:57
lifelessI need to sleep11:57
lifelessI'll think more about how to articulate this.11:58
magciusif you have an IUser and you want an IAuthToken, going through an intermediate IPotato shouldn't effect the result.11:58
lifelessuhm11:58
lifelessI think you're talking about something different.11:59
magciusyou go to bed. I will too.12:00
lifelessNoddy example.12:00
lifelesssay you have ICar and IPassenger12:00
lifelessand a Car instance with 3 Passengers.12:00
lifelessWhats the behaviour of IPassenger(car)12:00
magciusit throws an error12:00
magciusor raises12:00
lifelessif there is an adapter present it won't.12:01
lifelessthat doesn't make it useful.12:01
magciusthe adapter throws an error12:01
magciusif there's more than one passenger :)12:01
lifelessif you do that, then you have code that will sometimes work and sometimes not.12:01
magciusrealistically, this is the wrong use of adaptation12:01
lifelessSee - when I see a right use of it, I will be happy.12:02
magciusin my code, all my use of interfaces is bascially 'isinstance' on steroids.12:02
lifelessI have *honestly* not seen a problem in python made simpler by using interfaces.12:02
magciusIt's extremely, uh, method-based.12:02
lifelessmagcius: using isinstance is a design problem in the first place.12:02
magciuslifeless, there are certain extreme cases where it is necessary.12:02
lifeless!cite12:03
lifeless :)12:03
lifelessI'm going to crash. Feel free to pick this up another time if you like.12:03
magciusOK12:04
magciuslifeless, http://paste.pound-python.org/show/TrBZVgWsMKEHo5EtQv8c/12:08
magciuslifeless, you may say that's extreme edgecase... but this is what 90% of what my usage of z.i is12:09
magciusI would have to subclass if I wanted to add something else, and it quickly became messy.12:10
magciusso, I left a "hook".12:10
lifelesshttp://paste.pound-python.org/show/7357/12:14
lifelessvery quick-n-dirty12:14
magcius... and it's failing to load12:14
magciusgreat12:14
* magcius shoots _habnabit in the face.12:14
lifelessI wouldn't normally do that, but am working on the assumption you can't fix your types ;)12:14
lifelessdo you want me to paste it somewhere else?12:19
lifelesssay so now cause *yawn*12:19
* lifeless waves gnight12:21
LPCIBotProject windmill-db-devel build #339: STILL FAILING in 1 hr 8 min: https://lpci.wedontsleep.org/job/windmill-db-devel/339/17:14
=== issyl0_ is now known as Guest46812
=== Guest46812 is now known as issyl0
LPCIBotYippie, build fixed!20:50
LPCIBotProject db-devel build #593: FIXED in 4 hr 55 min: https://lpci.wedontsleep.org/job/db-devel/593/20:50
LPCIBotProject windmill-db-devel build #340: STILL FAILING in 1 hr 7 min: https://lpci.wedontsleep.org/job/windmill-db-devel/340/23:58

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