You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Dolan Halbrook <dh...@cisco.com> on 2007/06/16 00:09:57 UTC

Why is handle limited to alphanumeric characters?

Hi there,

I was wondering why the weblog handle is limited to alphanumeric characters. 
We would find it really useful to allow, say dashes or underscores, but
we're worried that defeating the validtion and doing this would cause
problems down the road.

Are strict alphanumeric handles still necessary or are they a legacy
restriction?

Many thanks,
Dolan Halbrook
-- 
View this message in context: http://www.nabble.com/Why-is-handle-limited-to-alphanumeric-characters--tf3930697s12275.html#a11148509
Sent from the Roller - Dev mailing list archive at Nabble.com.


Re: Why is handle limited to alphanumeric characters?

Posted by Dolan Halbrook <dh...@cisco.com>.
Thanks Denis for pointing that out.

I'll make sure to force the first character of the handle to be
alphabetical.

--Dolan


Denis Balazuc wrote:
> 
> 
>  > That said, I don't think allowing underbars or dashes will break 
> anything.
>  >
>  > - Dave
> 
> There may be an issue with 
> XXXJPAUserManagerImpl.getWeblogHandleLetterMap() if using 
> non-alphabetical chars.
> The implementation loops through a hard-wire list of characters. It 
> looks to me that this query could be written without the need of such a 
> static loop, using only SQL and allowing for any character internally 
> but some still need to be forbidden to avoid URL troubles.
> 
> public Map getWeblogHandleLetterMap() throws WebloggerException {
>          String lc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
>          Map results = new TreeMap();
>          Query query = strategy.getNamedQuery(
>                  "Weblog.getCountByHandleLike");
>          for (int i=0; i<26; i++) {
>              char currentChar = lc.charAt(i);
>              query.setParameter(1, currentChar + "%");
>              List row = query.getResultList();
>              Long count = (Long) row.get(0);
>              results.put(String.valueOf(currentChar), count);
>          }
>          return results;
>      }
> 
> NB: getUserNameLetterMap is implemented the same way, with a static list 
> of chars.
> 
> -- Denis
> 
> Dave wrote:
>> On 6/15/07, Dolan Halbrook <dh...@cisco.com> wrote:
>>> I was wondering why the weblog handle is limited to alphanumeric 
>>> characters.
>>> We would find it really useful to allow, say dashes or underscores, but
>>> we're worried that defeating the validtion and doing this would cause
>>> problems down the road.
>>>
>>> Are strict alphanumeric handles still necessary or are they a legacy
>>> restriction?
>> 
>> We restrict handles to alphanumerics to ensure that they can safely be
>> used in URLs. Perhaps that is overly restrictive, but I don't see a
>> great need to change (at least not until we have IRI support).
>> 
>> That said, I don't think allowing underbars or dashes will break
>> anything.
>> 
>> - Dave
>> 
>> 
>>>
>>> Many thanks,
>>> Dolan Halbrook
>>> -- 
>>> View this message in context: 
>>> http://www.nabble.com/Why-is-handle-limited-to-alphanumeric-characters--tf3930697s12275.html#a11148509 
>>>
>>> Sent from the Roller - Dev mailing list archive at Nabble.com.
>>>
>>>
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Why-is-handle-limited-to-alphanumeric-characters--tf3930697s12275.html#a11163763
Sent from the Roller - Dev mailing list archive at Nabble.com.


Re: Why is handle limited to alphanumeric characters?

Posted by Denis Balazuc <de...@balazuc.net>.
 > That said, I don't think allowing underbars or dashes will break 
anything.
 >
 > - Dave

There may be an issue with 
XXXJPAUserManagerImpl.getWeblogHandleLetterMap() if using 
non-alphabetical chars.
The implementation loops through a hard-wire list of characters. It 
looks to me that this query could be written without the need of such a 
static loop, using only SQL and allowing for any character internally 
but some still need to be forbidden to avoid URL troubles.

public Map getWeblogHandleLetterMap() throws WebloggerException {
         String lc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
         Map results = new TreeMap();
         Query query = strategy.getNamedQuery(
                 "Weblog.getCountByHandleLike");
         for (int i=0; i<26; i++) {
             char currentChar = lc.charAt(i);
             query.setParameter(1, currentChar + "%");
             List row = query.getResultList();
             Long count = (Long) row.get(0);
             results.put(String.valueOf(currentChar), count);
         }
         return results;
     }

NB: getUserNameLetterMap is implemented the same way, with a static list 
of chars.

-- Denis

Dave wrote:
> On 6/15/07, Dolan Halbrook <dh...@cisco.com> wrote:
>> I was wondering why the weblog handle is limited to alphanumeric 
>> characters.
>> We would find it really useful to allow, say dashes or underscores, but
>> we're worried that defeating the validtion and doing this would cause
>> problems down the road.
>>
>> Are strict alphanumeric handles still necessary or are they a legacy
>> restriction?
> 
> We restrict handles to alphanumerics to ensure that they can safely be
> used in URLs. Perhaps that is overly restrictive, but I don't see a
> great need to change (at least not until we have IRI support).
> 
> That said, I don't think allowing underbars or dashes will break anything.
> 
> - Dave
> 
> 
>>
>> Many thanks,
>> Dolan Halbrook
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Why-is-handle-limited-to-alphanumeric-characters--tf3930697s12275.html#a11148509 
>>
>> Sent from the Roller - Dev mailing list archive at Nabble.com.
>>
>>
> 

Re: Why is handle limited to alphanumeric characters?

Posted by Dave <sn...@gmail.com>.
On 6/15/07, Dolan Halbrook <dh...@cisco.com> wrote:
> I was wondering why the weblog handle is limited to alphanumeric characters.
> We would find it really useful to allow, say dashes or underscores, but
> we're worried that defeating the validtion and doing this would cause
> problems down the road.
>
> Are strict alphanumeric handles still necessary or are they a legacy
> restriction?

We restrict handles to alphanumerics to ensure that they can safely be
used in URLs. Perhaps that is overly restrictive, but I don't see a
great need to change (at least not until we have IRI support).

That said, I don't think allowing underbars or dashes will break anything.

- Dave


>
> Many thanks,
> Dolan Halbrook
> --
> View this message in context: http://www.nabble.com/Why-is-handle-limited-to-alphanumeric-characters--tf3930697s12275.html#a11148509
> Sent from the Roller - Dev mailing list archive at Nabble.com.
>
>