On Thu, 20 May 2010 17:59:32 -0000, Leonard Richardson <email address hidden> wrote:
> Actually all entry objects would benefit from starting out as empty
> shims. If you write bug.owner.someNamedOperation() there's no reason to
> actually get a representation of bug.owner.
One thing to be careful of is that
lp.me.someNamedOperation()
still works.
If you POST to
/+me/
then you get a redirect (302 I believe), check that the http library
doesn't turn this in to a GET of /~your-id/. The HTTP rfc says that
anything but GET or HEAD shouldn't automatically follow a 302.
Also, txrestfulclient uses shims, but for a different reason, because
making __getattr__ return a Deferred would be both ugly and really hard
to use. It still does the intermediate GET requests, but I should see
about short circuiting that.
What it does have to have is an explicit way to resolve (lp_resolve()
was picked), so that you control when you get a deferred. This means
that you don't have to trigger a GET when anything is done to the
object. If you use shims for every attribute then I guess you have to
have the shim check for a representation for during __getattr__, __eq__,
__str__, etc.
On Thu, 20 May 2010 17:59:32 -0000, Leonard Richardson <email address hidden> wrote: someNamedOperat ion() there's no reason to
> Actually all entry objects would benefit from starting out as empty
> shims. If you write bug.owner.
> actually get a representation of bug.owner.
One thing to be careful of is that
lp.me. someNamedOperat ion()
still works.
If you POST to
/+me/
then you get a redirect (302 I believe), check that the http library
doesn't turn this in to a GET of /~your-id/. The HTTP rfc says that
anything but GET or HEAD shouldn't automatically follow a 302.
Also, txrestfulclient uses shims, but for a different reason, because
making __getattr__ return a Deferred would be both ugly and really hard
to use. It still does the intermediate GET requests, but I should see
about short circuiting that.
What it does have to have is an explicit way to resolve (lp_resolve()
was picked), so that you control when you get a deferred. This means
that you don't have to trigger a GET when anything is done to the
object. If you use shims for every attribute then I guess you have to
have the shim check for a representation for during __getattr__, __eq__,
__str__, etc.
Thanks,
James