Re: Pony request: refetch method to models

2010-01-27 Thread Alex Gaynor
On Wed, Jan 27, 2010 at 12:23 PM, Karen Tracey  wrote:
> On Wed, Jan 27, 2010 at 12:17 PM, Alex Gaynor  wrote:
>>
>> I'm almost positive this is a dupe of another ticket, in the 3000-6000
>> range I think.
>
> The one I found was #901.
>
> Karen
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>

That one may be the one I'm thinking of (I've apparently seen it
before anyways), but I seem to recall one with a patch on it.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Pony request: refetch method to models

2010-01-27 Thread Karen Tracey
On Wed, Jan 27, 2010 at 12:17 PM, Alex Gaynor  wrote:

> I'm almost positive this is a dupe of another ticket, in the 3000-6000
> range I think.
>

The one I found was #901.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Pony request: refetch method to models

2010-01-27 Thread Alex Gaynor
2010/1/27 Jukka Välimaa :
> Sounds reasonable. I couldn't find an existing ticket, so I made a new one,
> #12709.
> --Jukka
>
> On Wed, Jan 27, 2010 at 2:34 AM, Russell Keith-Magee
>  wrote:
>>
>> On Wed, Jan 27, 2010 at 12:59 AM, Jukka  wrote:
>> > Hi all,
>> >
>> > I'd like to propose adding a method to Model that can be used to fetch
>> > a "fresh" version of a model object from the database.
>>
>> This isn't a completely unreasonble idea, but it is an unreasonable
>> time to suggest it :-)
>>
>> We are days away from our feature freeze for 1.2. At this point, any
>> new ideas will need to wait until 1.3.
>>
>> I'm fairly certain this idea has been proposed before, so there's
>> probably a ticket for it, too. If there isn't, open a new ticket so we
>> don't forget the idea.
>>
>> If you want to propose this for 1.3, keep an eye on the release
>> schedule; once 1.2 is released, we'll start discussing the features we
>> want in 1.3.
>>
>> Yours,
>> Russ Magee %-)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To post to this group, send email to django-develop...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-developers+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-developers?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>

I'm almost positive this is a dupe of another ticket, in the 3000-6000
range I think.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Pony request: refetch method to models

2010-01-27 Thread Jukka Välimaa
Sounds reasonable. I couldn't find an existing ticket, so I made a new one,
#12709.

--Jukka

On Wed, Jan 27, 2010 at 2:34 AM, Russell Keith-Magee  wrote:

> On Wed, Jan 27, 2010 at 12:59 AM, Jukka  wrote:
> > Hi all,
> >
> > I'd like to propose adding a method to Model that can be used to fetch
> > a "fresh" version of a model object from the database.
>
> This isn't a completely unreasonble idea, but it is an unreasonable
> time to suggest it :-)
>
> We are days away from our feature freeze for 1.2. At this point, any
> new ideas will need to wait until 1.3.
>
> I'm fairly certain this idea has been proposed before, so there's
> probably a ticket for it, too. If there isn't, open a new ticket so we
> don't forget the idea.
>
> If you want to propose this for 1.3, keep an eye on the release
> schedule; once 1.2 is released, we'll start discussing the features we
> want in 1.3.
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Pony request: refetch method to models

2010-01-27 Thread Jukka Välimaa
For the method to be available conveniently, I would have to make it into a
single class, and then subclass all my other model classes from that. I
could do it, but if this is useful enough, it should be available by
default, without requiring every single person to write the method on their
own. Also, that solution would do nothing to various contrib and third-party
models.

--Jukka

On Tue, Jan 26, 2010 at 9:22 PM, Chris  wrote:

> On Jan 26, 11:59 am, Jukka  wrote:
> > Hi all,
> >
> > I'd like to propose adding a method to Model that can be used to fetch
> > a "fresh" version of a model object from the database. This is
> > something that I personally would often find useful. Usually this
> > happens when I'm testing some view code using the test client, and the
> > view is supposed to save some model changes into database. For
> > example:
> >
> > client.post('some_url', {'id': obj.id, 'description': 'new'})
> > fresh_obj = ObjClass.objects.get(pk=obj.pk)
> > self.assertEqual('new', fresh_obj.description)
> >
> > Now, I think that way of refreshing a model object is inelegant. What
> > I propose is a method that would be functionally identical to how a
> > fresh object is fetched above:
> >
> > fresh_obj = obj.refetch()
> >
> > This is a convenience method, but based on my own experience it would
> > be... well, convenient. I'd like to hear whether you think the
> > convenience would be worth extending the api. If you think it's worth
> > it, I'd be happy to write a patch.
> >
> > --Jukka
>
> Why not just make a custom model method?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Pony request: refetch method to models

2010-01-26 Thread Russell Keith-Magee
On Wed, Jan 27, 2010 at 12:59 AM, Jukka  wrote:
> Hi all,
>
> I'd like to propose adding a method to Model that can be used to fetch
> a "fresh" version of a model object from the database.

This isn't a completely unreasonble idea, but it is an unreasonable
time to suggest it :-)

We are days away from our feature freeze for 1.2. At this point, any
new ideas will need to wait until 1.3.

I'm fairly certain this idea has been proposed before, so there's
probably a ticket for it, too. If there isn't, open a new ticket so we
don't forget the idea.

If you want to propose this for 1.3, keep an eye on the release
schedule; once 1.2 is released, we'll start discussing the features we
want in 1.3.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Pony request: refetch method to models

2010-01-26 Thread Chris
On Jan 26, 11:59 am, Jukka  wrote:
> Hi all,
>
> I'd like to propose adding a method to Model that can be used to fetch
> a "fresh" version of a model object from the database. This is
> something that I personally would often find useful. Usually this
> happens when I'm testing some view code using the test client, and the
> view is supposed to save some model changes into database. For
> example:
>
> client.post('some_url', {'id': obj.id, 'description': 'new'})
> fresh_obj = ObjClass.objects.get(pk=obj.pk)
> self.assertEqual('new', fresh_obj.description)
>
> Now, I think that way of refreshing a model object is inelegant. What
> I propose is a method that would be functionally identical to how a
> fresh object is fetched above:
>
> fresh_obj = obj.refetch()
>
> This is a convenience method, but based on my own experience it would
> be... well, convenient. I'd like to hear whether you think the
> convenience would be worth extending the api. If you think it's worth
> it, I'd be happy to write a patch.
>
> --Jukka

Why not just make a custom model method?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Pony request: refetch method to models

2010-01-26 Thread Jukka
Hi all,

I'd like to propose adding a method to Model that can be used to fetch
a "fresh" version of a model object from the database. This is
something that I personally would often find useful. Usually this
happens when I'm testing some view code using the test client, and the
view is supposed to save some model changes into database. For
example:

client.post('some_url', {'id': obj.id, 'description': 'new'})
fresh_obj = ObjClass.objects.get(pk=obj.pk)
self.assertEqual('new', fresh_obj.description)

Now, I think that way of refreshing a model object is inelegant. What
I propose is a method that would be functionally identical to how a
fresh object is fetched above:

fresh_obj = obj.refetch()

This is a convenience method, but based on my own experience it would
be... well, convenient. I'd like to hear whether you think the
convenience would be worth extending the api. If you think it's worth
it, I'd be happy to write a patch.

--Jukka

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.