#5270 closed (fixed)
Template tags won't accept an empty string as an argument
| Reported by: | stephen | Owned by: | Jeremy Dunck | 
|---|---|---|---|
| Component: | Template system | Version: | dev | 
| Severity: | Keywords: | empty string tplrf-fixed | |
| Cc: | jdunck@… | Triage Stage: | Ready for checkin | 
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
There currently appears to be no easy to pass an empty string to a template tag.
{% url admin "" %} results in a TemplateSyntaxError.  
Some template tags (notable reverse URL lookups for the root of a newforms-admin instance) require an empty string to be passed in.
Attachments (2)
Change History (12)
comment:1 by , 18 years ago
| Triage Stage: | Unreviewed → Design decision needed | 
|---|
comment:2 by , 18 years ago
by , 17 years ago
| Attachment: | empty-string.patch added | 
|---|
Patch to allow empty constant strings as filter arguments
comment:3 by , 17 years ago
| Has patch: | set | 
|---|---|
| Owner: | changed from to | 
| Status: | new → assigned | 
Added a patch
comment:4 by , 17 years ago
| Keywords: | tplrf-fixed added | 
|---|
This would be fixed by the refactoring proposed in #7806.
comment:5 by , 17 years ago
| milestone: | → 1.0 | 
|---|
by , 17 years ago
| Attachment: | 5270-empty-string-template-w-tests.diff added | 
|---|
Added tests, and now handling the empty i18n constant specially for translation.
comment:6 by , 17 years ago
| Cc: | added | 
|---|---|
| Triage Stage: | Design decision needed → Ready for checkin | 
comment:7 by , 17 years ago
| Owner: | changed from to | 
|---|---|
| Status: | assigned → new | 
comment:8 by , 17 years ago
| Status: | new → assigned | 
|---|
comment:9 by , 17 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
This is due to
if i18n_constant: var = '"%s"' % _(i18n_constant.replace(r'\"', '"')) elif constant: var = '"%s"' % constant.replace(r'\"', '"')in FilterExpression.init(), where the elif-clause should probably check for is None.
Would be nice if this could be fixed.