I don't know what else is wrong but:

On Wed, Aug 26, 2009 at 8:15 PM, MIL <needb...@gmail.com> wrote:

>        bits = token.contents.split()


should probably be:

    bits = token.split_contents()

and render must return a string whether or not there is an
ObjectDoesNotExist exception, so, maybe:

       def render(self, context):
               try:
                       context[self.varname] =
Blog.objects.get(user=self.user)
               except ObjectDoesNotExist:
                       context[self.varname] = None   # Or whatever you want
to get if the user doesn't exist
                       # Or, if the variable was previously set to the no
such user value, use "pass".
               return ""


Another issue, if I understand another thread correctly, is that the
variable assignment will go away when you return (the dictionary stack will
be popped).  Or this might only apply from one file to another (extends,
include).  I'm not sure of that.  The tag that I wrote has a matching end
tag, so the stuff between gets rendered before my render returns, and the
variable that I set is available there.

Bill

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to