PRPath>>isValidName: and extended characters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PRPath>>isValidName: and extended characters

NorbertHartl
I like to use unicode characters in pier url paths. Nowadays encodeForHTTP changed in pharo and squeak to do utf-8 url-safe-encoding by default. I updated the implementation in the gemstone squeak package to do the same. So principal there is no need to be very restrictive in pier names.

I did some tests with changing the implementation to

PRPath>>isValidName: aString
        ^ aString isNil not
                and: [ aString isEmpty not
                and: [ aString ~= self parentStructure
                and: [ aString ~= self currentStructure
                and: [ aString allSatisfy: [ :char | char isAlphaNumeric or: [self validCharacters includes: char] ] ] ] ] ]

and it works well. PRPath>>validCharacters: could be reduced to just contain '-._'. Ok, the naming needs probably to be adjusted. But I think it is worth the change.

What do you think?

Norbert


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRPath>>isValidName: and extended characters

Lukas Renggli
I integrated this with

Name: Pier-Model-lr.393
Author: lr
Time: 9 October 2010, 11:34:48 am
UUID: e26211c8-e382-44d8-bb18-7222fd290a32
Ancestors: Pier-Model-lr.392

On 8 October 2010 22:50, Norbert Hartl <[hidden email]> wrote:

> I like to use unicode characters in pier url paths. Nowadays encodeForHTTP changed in pharo and squeak to do utf-8 url-safe-encoding by default. I updated the implementation in the gemstone squeak package to do the same. So principal there is no need to be very restrictive in pier names.
>
> I did some tests with changing the implementation to
>
> PRPath>>isValidName: aString
>        ^ aString isNil not
>                and: [ aString isEmpty not
>                and: [ aString ~= self parentStructure
>                and: [ aString ~= self currentStructure
>                and: [ aString allSatisfy: [ :char | char isAlphaNumeric or: [self validCharacters includes: char] ] ] ] ] ]
>
> and it works well. PRPath>>validCharacters: could be reduced to just contain '-._'. Ok, the naming needs probably to be adjusted. But I think it is worth the change.
>
> What do you think?
>
> Norbert
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRPath>>isValidName: and extended characters

NorbertHartl
Thanks Lukas,

but now the suggestName: is reduced. Probably it is better to implement it like in the attached changeset.

thanks,

Norbert




On 09.10.2010, at 11:35, Lukas Renggli wrote:

> I integrated this with
>
> Name: Pier-Model-lr.393
> Author: lr
> Time: 9 October 2010, 11:34:48 am
> UUID: e26211c8-e382-44d8-bb18-7222fd290a32
> Ancestors: Pier-Model-lr.392
>
> On 8 October 2010 22:50, Norbert Hartl <[hidden email]> wrote:
>> I like to use unicode characters in pier url paths. Nowadays encodeForHTTP changed in pharo and squeak to do utf-8 url-safe-encoding by default. I updated the implementation in the gemstone squeak package to do the same. So principal there is no need to be very restrictive in pier names.
>>
>> I did some tests with changing the implementation to
>>
>> PRPath>>isValidName: aString
>>        ^ aString isNil not
>>                and: [ aString isEmpty not
>>                and: [ aString ~= self parentStructure
>>                and: [ aString ~= self currentStructure
>>                and: [ aString allSatisfy: [ :char | char isAlphaNumeric or: [self validCharacters includes: char] ] ] ] ] ]
>>
>> and it works well. PRPath>>validCharacters: could be reduced to just contain '-._'. Ok, the naming needs probably to be adjusted. But I think it is worth the change.
>>
>> What do you think?
>>
>> Norbert
>>
>>
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

prpath-isvalidcharacter.1.cs (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PRPath>>isValidName: and extended characters

Lukas Renggli
Thanks this is integrated with

Name: Pier-Model-lr.394
Author: lr
Time: 9 October 2010, 12:42:57 pm
UUID: 91d82b31-5216-453c-9073-1c0037974923
Ancestors: Pier-Model-lr.393

- improved #suggestedName:, thanks go to Norbert for
prpath-isvalidcharacter.1.cs

Name: Pier-Tests-Model-lr.14
Author: lr
Time: 9 October 2010, 12:43:06 pm
UUID: 5dd6f62e-e3ce-4337-91e3-a21dafd47141
Ancestors: Pier-Tests-Model-lr.13

- improved #suggestedName:, thanks go to Norbert for
prpath-isvalidcharacter.1.cs


Note that I also changed the suggested name to only have lowercase
characters. While this is not really necessary I like paths to have
lowercase letters only, and this makes it easier.

Lukas

On 9 October 2010 12:02, Norbert Hartl <[hidden email]> wrote:

> Thanks Lukas,
>
> but now the suggestName: is reduced. Probably it is better to implement it like in the attached changeset.
>
> thanks,
>
> Norbert
>
>
>
>
> On 09.10.2010, at 11:35, Lukas Renggli wrote:
>
>> I integrated this with
>>
>> Name: Pier-Model-lr.393
>> Author: lr
>> Time: 9 October 2010, 11:34:48 am
>> UUID: e26211c8-e382-44d8-bb18-7222fd290a32
>> Ancestors: Pier-Model-lr.392
>>
>> On 8 October 2010 22:50, Norbert Hartl <[hidden email]> wrote:
>>> I like to use unicode characters in pier url paths. Nowadays encodeForHTTP changed in pharo and squeak to do utf-8 url-safe-encoding by default. I updated the implementation in the gemstone squeak package to do the same. So principal there is no need to be very restrictive in pier names.
>>>
>>> I did some tests with changing the implementation to
>>>
>>> PRPath>>isValidName: aString
>>>        ^ aString isNil not
>>>                and: [ aString isEmpty not
>>>                and: [ aString ~= self parentStructure
>>>                and: [ aString ~= self currentStructure
>>>                and: [ aString allSatisfy: [ :char | char isAlphaNumeric or: [self validCharacters includes: char] ] ] ] ] ]
>>>
>>> and it works well. PRPath>>validCharacters: could be reduced to just contain '-._'. Ok, the naming needs probably to be adjusted. But I think it is worth the change.
>>>
>>> What do you think?
>>>
>>> Norbert
>>>
>>>
>>> _______________________________________________
>>> Magritte, Pier and Related Tools ...
>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki