Hi all, I'm trying to pass a string to a custom tag to create custom breadcrumbs.
I'm using as a base the snippet at http://www.djangosnippets.org/snippets/656/ and using the documentation from http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ But it seems that I'm not able to pass the URL as a string. In ... zsite/ancore/templatetags/mytags.py (zsite is the django project directory) I have: ============================================================== #!/usr/bin/python # encoding: utf-8 from django import template from django.utils.safestring import mark_safe from django.utils.translation import ugettext from django.template.defaultfilters import stringfilter from types import * register = template.Library() @register.filter(name='dovesono') @stringfilter def dovesono(aurl): bc = u'' parti=aurl.split('/') bc= u' - %s - len=%d char= %s %s' % (parti[0],len(parti),aurl.count('/'),(type(aurl) == StringTypes)) for i in range(len(parti)): bc=bc+' » '+parti[i] return mark_safe(bc) ============================================================== In the calling template I have: ============================================================== {% block breadcrumbs %} {% load mytags %} <div class="breadcrumbs"> {{ request.get_full_path|dovesono }} </div> {% endblock %} ============================================================== and the generated html is: ============================================================== <div class="breadcrumbs"> - - len=1 char= 0 False » </div> ============================================================== So (type(aurl) == StringTypes) is evaluated False What I'm doing wrong? What is the method to pass the actual url to a filter as a string? Thanks Mirto -- _________________________________________________________________________ Busico Mirto Silvio Consulente ICT cell. 333 4562651 email [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---