Spaces between argument separator and argument in template filter generate error

2018-05-30 Thread oliver


In the template filter system now,

spaces between augment separator and augments generate error.
For example, the following template code generates the following error.

{{ value | filter: "arg"}}

TemplateSyntaxError at /
Could not parse the remainder: ': "arg"' from 'value | filter: "arg"'

https://code.djangoproject.com/ticket/29457


What do you think of this ticket?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/41376429-949c-4202-9074-5dc0200fc8ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-05-31 Thread Adam Johnson
I think it's better to be conservative here and leave it as-is, the current
syntax has worked for years and this change doesn't really reduce the risk
of bugs.

On Thu, 31 May 2018 at 03:34,  wrote:

> In the template filter system now,
>
> spaces between augment separator and augments generate error.
> For example, the following template code generates the following error.
>
> {{ value | filter: "arg"}}
>
> TemplateSyntaxError at /
> Could not parse the remainder: ': "arg"' from 'value | filter: "arg"'
>
> https://code.djangoproject.com/ticket/29457
>
>
> What do you think of this ticket?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/41376429-949c-4202-9074-5dc0200fc8ef%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM2GpwgemVHKkrr8yM%2B9%2B35Wk8N7P0_2oTekL_kSwaKkdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-05-31 Thread oliver
Are there any reasons that not allow spaces between separator and arg?

2018년 5월 31일 목요일 오전 11시 41분 22초 UTC+9, oli...@kidsnote.com 님의 말:
>
> In the template filter system now,
>
> spaces between augment separator and augments generate error.
> For example, the following template code generates the following error.
>
> {{ value | filter: "arg"}}
>
> TemplateSyntaxError at /
> Could not parse the remainder: ': "arg"' from 'value | filter: "arg"'
>
> https://code.djangoproject.com/ticket/29457
>
>
> What do you think of this ticket?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/131b5095-c5b7-4492-92fa-e58912ac842a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-05-31 Thread James Bennett
On Thu, May 31, 2018 at 1:39 AM,  wrote:

> Are there any reasons that not allow spaces between separator and arg?
>

Every optional variant of template syntax is a potential source of bugs or
compatibility issues for the future. And a potential source of confusion
when someone is trying to learn by reading code -- why did one developer do
it *this* way, while another developer did it *that* way? And another
choice every dev team has to make when putting together their style guide,
and another option they have to set on their linters, to make sure they get
a consistent codebase.

For these reasons, the default position should be "don't add it unless
there's a very good reason to". If there is a good reason to add it, please
explain so we can understand why you're requesting it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAL13Cg98d4UX2RcypOeiRnCU-TczNzqO90unjLgt4y8q8YugPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-05-31 Thread oliver
Thank you for your reply.
I understand your opinion well

2018년 5월 31일 목요일 오전 11시 41분 22초 UTC+9, oli...@kidsnote.com 님의 말:
>
> In the template filter system now,
>
> spaces between augment separator and augments generate error.
> For example, the following template code generates the following error.
>
> {{ value | filter: "arg"}}
>
> TemplateSyntaxError at /
> Could not parse the remainder: ': "arg"' from 'value | filter: "arg"'
>
> https://code.djangoproject.com/ticket/29457
>
>
> What do you think of this ticket?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b133457b-e474-47b6-b37f-cdab3fa6ee2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-05-31 Thread Collin Anderson
Maybe it would be worth having a more friendly error message?

On Thu, May 31, 2018 at 8:59 PM,  wrote:

> Thank you for your reply.
> I understand your opinion well
>
> 2018년 5월 31일 목요일 오전 11시 41분 22초 UTC+9, oli...@kidsnote.com 님의 말:
>>
>> In the template filter system now,
>>
>> spaces between augment separator and augments generate error.
>> For example, the following template code generates the following error.
>>
>> {{ value | filter: "arg"}}
>>
>> TemplateSyntaxError at /
>> Could not parse the remainder: ': "arg"' from 'value | filter: "arg"'
>>
>> https://code.djangoproject.com/ticket/29457
>>
>>
>> What do you think of this ticket?
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/b133457b-e474-47b6-b37f-
> cdab3fa6ee2f%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFO84S4oFP_hxC6u84HagpXJy3ko7hvTkQjTO85CNfegFSX%3DUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-01 Thread Alasdair Nicol
On Friday, 1 June 2018 03:06:01 UTC+1, Collin Anderson wrote:

> Maybe it would be worth having a more friendly error message?
>
>
I agree, it would be good to improve the message.

I've also seen users confused by the "could not parse the remainder" 
message when they forget the spaces around boolean operators, for example:

{% if foo=='bar' %}

On Thu, May 31, 2018 at 8:59 PM, > wrote:
>
>> Thank you for your reply.
>> I understand your opinion well
>>
>> 2018년 5월 31일 목요일 오전 11시 41분 22초 UTC+9, oli...@kidsnote.com 님의 말:
>>>
>>> In the template filter system now,
>>>
>>> spaces between augment separator and augments generate error.
>>> For example, the following template code generates the following error.
>>>
>>> {{ value | filter: "arg"}}
>>>
>>> TemplateSyntaxError at /
>>> Could not parse the remainder: ': "arg"' from 'value | filter: "arg"'
>>>
>>> https://code.djangoproject.com/ticket/29457
>>>
>>>
>>> What do you think of this ticket?
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com .
>> To post to this group, send email to django-d...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/b133457b-e474-47b6-b37f-cdab3fa6ee2f%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4747632d-4b1e-43f5-a99f-11b2efbaa49f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-01 Thread Curtis Maloney

On 05/31/2018 06:39 PM, oli...@kidsnote.com wrote:

Are there any reasons that not allow spaces between separator and arg?


My first thought would be that it starts making the syntax looser, 
meaning more things that are currently error cases would be accepted as 
valid.


Which means mistakes will no longer raise errors.

--
Curtis


2018년 5월 31일 목요일 오전 11시 41분 22초 UTC+9, oli...@kidsnote.com 님 
의 말:


In the template filter system now,

spaces between augment separator and augments generate error.
For example, the following template code generates the following error.

{{ value | filter: "arg"}}

TemplateSyntaxError at /
Could not parse the remainder: ': "arg"' from 'value | filter: "arg"'

https://code.djangoproject.com/ticket/29457



What do you think of this ticket?

--
You received this message because you are subscribed to the Google 
Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-developers+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-developers@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/131b5095-c5b7-4492-92fa-e58912ac842a%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ab2d6097-51e4-56a2-e096-3a8189cdc6eb%40tinbrain.net.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-04 Thread oliver
Currently, django template system allow spaces between filter separator and 
filter name, also value name and filter separator. 
So, following is ok.

{{ value|filter:"arg" }}
{{ value|filter:"arg" }}

But, following can't be parsed

{{ value|filter: "arg" }}

I think that this syntax is inconsistent.
So allowing spaces between filter name and filter separator is better.


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/8d9bc320-222b-42cf-934e-644d29cb6ba0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-04 Thread oliver


2018년 6월 5일 화요일 오전 10시 52분 16초 UTC+9, oli...@kidsnote.com 님의 말:
>
> Currently, django template system allow spaces between filter separator 
> and filter name, also value name and filter separator. 
> So, following is ok.
>
> {{ value|filter:"arg" }}
> {{ value|filter:"arg" }}
>
> But, following can't be parsed
>
> {{ value|filter: "arg" }}
>
> I think that this syntax is inconsistent.
> So allowing spaces between filter argument separator and filter argument 
> is better.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/dada5fc6-3fad-4811-af17-4c911d4ab2a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-04 Thread oliver
Currently, spaces between filter separator( | ) and filter name is allowed. 
Also, value name and filter separator.
So, following is allowed.

{{ value|filter:"arg" }}
{{ value|filter:"arg" }}

But, following is not allowed.

{{ value|filter: "arg" }}

users are confused by the inconsistency. 

I think that either the error message or syntax should be improved.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7152e2da-bd50-4496-b173-18466e2da01d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-04 Thread oliver


filter_raw_string = r"""
^(?P%(constant)s)|
^(?P[%(var_chars)s]+|%(num)s)|
 (?:\s*%(filter_sep)s\s*
 (?P\w+)
 (?:%(arg_sep)s
 (?:
  (?P%(constant)s)|
  (?P[%(var_chars)s]+|%(num)s)
 )
 )?
 )""" % {
'constant': constant_string,
'num': r'[-+\.]?\d[\d\.e]*',
'var_chars': r'\w\.',
'filter_sep': re.escape(FILTER_SEPARATOR),
'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR),
}


allowing spaces can be done by adding \s* after (arg_sep)s

2018년 6월 5일 화요일 오전 11시 17분 51초 UTC+9, oli...@kidsnote.com 님의 말:
>
> Currently, spaces between filter separator( | ) and filter name is 
> allowed. Also, value name and filter separator.
> So, following is allowed.
>
> {{ value|filter:"arg" }}
> {{ value|filter:"arg" }}
>
> But, following is not allowed.
>
> {{ value|filter: "arg" }}
>
> users are confused by the inconsistency. 
>
> I think that either the error message or syntax should be improved.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/2f27f356-e225-441a-8fd2-4f49d23f5d14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-04 Thread oliver


filter_raw_string = r"""
^(?P%(constant)s)|
^(?P[%(var_chars)s]+|%(num)s)|
 (?:\s*%(filter_sep)s\s*
 (?P\w+)
 (?:%(arg_sep)s
 (?:
  (?P%(constant)s)|
  (?P[%(var_chars)s]+|%(num)s)
 )
 )?
 )""" % {
'constant': constant_string,
'num': r'[-+\.]?\d[\d\.e]*',
'var_chars': r'\w\.',
'filter_sep': re.escape(FILTER_SEPARATOR),
'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR),
}


allowing spaces can be done by simply adding \s* after (arg_sep)s

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f87d71f0-c3d6-4155-bff3-b7693123c60c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-06 Thread Florian Apolloner


On Tuesday, June 5, 2018 at 4:30:03 AM UTC+2, oli...@kidsnote.com wrote:
>
> allowing spaces can be done by simply adding \s* after (arg_sep)s
>

\s is __not__ the regex for spaces

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/3b212784-43ab-409c-88ad-59c14a2c5cf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spaces between argument separator and argument in template filter generate error

2018-06-06 Thread oliver
Sorry my mistake. It means white spaces  character not spaces

2018년 6월 6일 수요일 오후 6시 3분 48초 UTC+9, Florian Apolloner 님의 말:
>
>
>
> On Tuesday, June 5, 2018 at 4:30:03 AM UTC+2, oli...@kidsnote.com wrote:
>>
>> allowing spaces can be done by simply adding \s* after (arg_sep)s
>>
>
> \s is __not__ the regex for spaces
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/03eff6d7-7aa5-441f-a2d1-16d2f2db07b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.