Re: Advice for a replacement for plone.

2008-10-02 Thread Dmitry S. Makovey
disclaimer: I'm not affiliated with any company selling Plone services ;) I also have nothing against Django and such. Ken Seehart wrote: > I want a new python based CMS. ... One that won't keep me up all night > > > I've been fooling around with zope and plone, and I like plone for some

Re: is decorator the right thing to use?

2008-09-28 Thread Dmitry S. Makovey
George Sakkis wrote: > FYI, in case you missed it the final version doesn't need a Proxy base > class, just inherit from object. Also lowercased ProxyMethod to look > similar to staticmethod/classmethod: I cought that, just quoted the wrong one :) > class A(object): > > def __init__(self, b1

Re: is decorator the right thing to use?

2008-09-27 Thread Dmitry S. Makovey
George Sakkis wrote: > It's funny how often you come with a better solution a few moments > after htting send! The snippet above can (ab)use the decorator syntax > so that it becomes: > > class A(Proxy): > > @ProxyMethod > def bmethod(self): > return self.b1 > > @ProxyMethod

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
George Sakkis wrote: > You seem to enjoy pulling the rug from under our feet by changing the > requirements all the time :) but that's half the fun! ;) Bit more seriously - I didn't know I had those requirements until now :) I'm kind of exploring where can I get with those ideas. Initial post was

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: > That prohibits using a descriptor in the proxied classes, or at least > the proxied functions, since you break descriptor protocol and only > call __get__ once. Better to cache and get by name. It's only slower > by the normal amount, and technically saves space,

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
Bruno Desthuilliers wrote: > Hem... I'm afraid you don't really take Python's dynamic nature into > account here. Do you know that even the __class__ attribute of an > instance can be rebound at runtime ? What about 'once and for all' then ? must've been wrong wording on my part. Dynamic nature is

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
Paul McGuire wrote: >> see, in your code you're assuming that there's only 1 property ( 'b' ) >> inside of A that needs proxying. In reality I have several. > > No, really, Diez has posted the canonical Proxy form in Python, using > __getattr__ on the proxy, and then redirecting to the contained

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Dmitry S. Makovey
Diez B. Roggisch wrote: > Well, you certainly want a desktop-orientied Linux for users, so you > chose ubuntu - but then on the server you go with a more stable debian > system. Even though the both have the same technical and even package > management-base, they are still incompatible wrt to packa

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Dmitry S. Makovey
Diez B. Roggisch wrote: > - different OS. I for one don't know about a package management tool > for windows. And while our servers use Linux (and I as developer as > well), all the rest of our people use windows. No use telling them to > apt-get instal python-imaging. that is a very valid poin

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
George Sakkis wrote: > I'm not sure if the approach below deals with all the issues, but one > thing it does is decouple completely the proxied objects from the > proxy: > class _ProxyMeta(type): It smelled to me more and more like metaclass too, I was just trying to avoid them :) Your code

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Dmitry S. Makovey
Scott Sharkey wrote: > Any insight into the best way to have a consistent, repeatable, > controllable development and production environment would be much > appreciated. you have just described OS package building ;) I can't speak for everybody, but supporting multiple platforms (PHP, Perl, Pytho

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: >> I kept this part of the problem out of this discussion as I'm pretty sure >> I can fill those in once I figure out the basic problem of >> auto-population of proxy methods since for each class/method those are >> going to be nearly identical. If I can autogenerate

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: > You should write it like this: > > class B(object): > @A.proxy > def bmethod(self,a): > > Making 'proxy' a class method on A. makes sense. > In case different A instances (do > you have more than one BTW?) yep. I have multiple instances of class

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Thanks Bruno, your comments were really helpful (so was the "improved" version of code). My replies below: Bruno Desthuilliers wrote: >> So decorators inside of B just identify that those methods will be >> proxied by A. On one hand from logical standpoint it's kind of weird to >> tell class th

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Diez B. Roggisch wrote: > Dmitry S. Makovey schrieb: >> Dmitry S. Makovey wrote: >>> In my real-life case A is a proxy to B, C and D instances/objects, not >>> just one. >> >> forgot to mention that above would mean that I need to have more than one >

Re: is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
Dmitry S. Makovey wrote: > In my real-life case A is a proxy to B, C and D instances/objects, not > just one. forgot to mention that above would mean that I need to have more than one decorator function like AproxyB, AproxyC and AproxyD or make Aproxy smarter about which property of

Re: is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: > It might help to tell us the order of events that you want in your > program. You're not using 'mymethod' or 'mymethod2', and you probably > want 'return fnew' for the future. Something dynamic with __getattr__ > might work. Any method call to A, that is an A

Re: is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
[EMAIL PROTECTED] wrote: > Your code below is very abstract, so it's kind of hard to figure out > what problem you're trying to solve, but it seems to me that you're > using the B proxy class to decorate the A target class, which means > you want one of these options: Sorry for unclarities in orig

is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
Hi, after hearing a lot about decorators and never actually using one I have decided to give it a try. My particular usecase is that I have class that acts as a proxy to other classes (i.e. passes messages along to those classes) however hand-coding this type of class is rather tedious, so I decid