On 7/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> If so, I may have performance issues if the processing in the method
> takes some time :-(

The method will be called each time-- django can't know whether the
method is deterministic.  Suppose you wanted a method to return the
current time?

It the dict will be the same each time it's called, you have a few
options: make a template tag and cache the result in the node, or
store the result locally and just return the stored result if
available.

So:

class model(...):
  def __init__(self, ...):
    self._previous_dict = None
  def expensive_dict(self, ...):
    if self._previous_dict:
      return self._previous_dict

    #..expensive stuff here
    self._previous_dict = results_of_process

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to