Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Getting the original object from a proxy in Python
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Paul Walsh  
View profile  
 More options Oct 31 2012, 9:18 am
From: Paul Walsh <paulywa...@gmail.com>
Date: Wed, 31 Oct 2012 06:18:00 -0700 (PDT)
Subject: Re: [pyweb-il:3717] Getting the original object from a proxy in Python

ok yes, I am using the pk now, so I guess this is the way to do it. thanks.

On Wednesday, 31 October 2012 13:19:27 UTC+2, Shai wrote:

> On Wednesday 31 October 2012 10:29:50 Paul Walsh wrote:
> > In a new project I am working with Django's proxy models, and it is just
> a
> > great great way to build pragmatic interfaces for views and templates.

> > In a few cases, however, I need to do things like check equality with
> the
> > original object, and my proxy is not actually equal to the original of
> > course.

> > I can do this by checking equality on class properties, where that
> property
> > is the same in the proxy and the original object.

> With Django objects you can usually rely on the pk property (except if
> your
> context involves unsaved objects).

> > I wonder if there is a better practice in python. I found some
> suggestions
> > to add a method on the original object that simply returns self

> That, simply, won't work -- such a method will return the dynamic self
> (the
> proxy), not an instance of the class in which it was defined (as might be
> the
> case in some static languages).

> HTH,
>         Shai.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.