[Building Sakai] EntityBroker. Spaces in custom action entity ids

Stephen Marquard stephen.marquard at uct.ac.za
Mon Aug 2 11:27:17 PDT 2010


I would venture a guess that siteids, like userids, are one thing you absolutely do not want to change after creation. Basically every tool will hold its own references to site ids / context, embedded in a variety of ways (table fields, XML blobs, URL fragments, etc.).

You would be better off changing EB to cope with the spaces.

Regards
Stephen 
 
>>> Adrian Fish <a.fish at lancaster.ac.uk> 8/2/2010 8:08 PM >>> 
It came about via the Sites tool in Sakai. You can create any site id 
you want and if you like nice human readable urls with spaces you may 
well be tempted to create site ids directly with them in. You may even 
be tempted to copy and paste the site title as the site id for simplicity.

The way I look at it either entity broker needs modifying or spaces in 
sites ids need to be prevented completely by modifying the Sites tool.

Does anybody have experience of changing site ids programmatically, 
without breaking everything?

Cheers,

Adrian.

Aaron Zeckoski wrote:
> I would say most devs would consider spaces and special chars in IDs
> to be a bad practice so I would recommend you investigate how this
> situation came to be in your local installation and try to fix it
> there.
>
> For now I would guess you can try changing TemplateParseUtil and the
> various VALID_*_CHARS sets to include spaces. I have a feeling that
> might not work because of other places where spaces are used in
> parsing the URLs but it's worth a shot.
>
> -AZ
>
>
> On Mon, Aug 2, 2010 at 1:40 PM, Adrian Fish <a.fish at lancaster.ac.uk> wrote:
>   
>> Okay, that means that the entire site provider will not work against any
>> sites with spaces in their ids. This effectively screws up all of my code
>> under our deployment as we have hundreds of sites with spaced site ids.
>>
>> Is there a workaround? Can I patch this locally so that spaces are allowed?
>>
>> Cheers,
>>
>> Adrian.
>>
>> Aaron Zeckoski wrote:
>>     
>>> I understand that. However, EB does not allow spaces in IDs (currently).
>>> -AZ
>>>
>>>
>>> On Mon, Aug 2, 2010 at 1:26 PM, Adrian Fish <a.fish at lancaster.ac.uk>
>>> wrote:
>>>
>>>       
>>>> But spaces are allowed in site ids and site ids can be entity ids. Using
>>>> the
>>>> sites tool you can specify a site id with spaces in it.
>>>>
>>>> Adrian.
>>>>
>>>> Aaron Zeckoski wrote:
>>>>
>>>>         
>>>>> OK, then the issue is that it expects IDs to conform to the limits I
>>>>> sent earlier as far as characters. Spaces are not allowed as part of
>>>>> an ID.
>>>>>
>>>>> -AZ
>>>>>
>>>>>
>>>>> On Mon, Aug 2, 2010 at 12:56 PM, Adrian Fish <a.fish at lancaster.ac.uk>
>>>>> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> It does. I tested that :)
>>>>>>
>>>>>> Aaron Zeckoski wrote:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> I am assuming it works fine for ones without spaces?
>>>>>>> -AZ
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Aug 2, 2010 at 12:48 PM, Adrian Fish <a.fish at lancaster.ac.uk>
>>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> Hi Aaron,
>>>>>>>>
>>>>>>>> I'm using 1.3.9 plus the !site.helper patch to the userPerms action
>>>>>>>> in
>>>>>>>> the
>>>>>>>> site provider.
>>>>>>>>
>>>>>>>> Hitting a url like this:
>>>>>>>> http://btc224000006.lancs.ac.uk/direct/site/a%20b%20c/pages.json ...
>>>>>>>>
>>>>>>>> ... yields this in the logs:
>>>>>>>>
>>>>>>>> INFO Could not process entity: /site (400)[null]: Cannot execute
>>>>>>>> custom
>>>>>>>> action (pages) for request method GET, The custom action view key
>>>>>>>> (show)
>>>>>>>> must match the request view key (list)
>>>>>>>>
>>>>>>>> Adrian.
>>>>>>>>
>>>>>>>> Aaron Zeckoski wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> An ID with a space in it? I am guessing the system is seeing it as a
>>>>>>>>> divider of some kind. IDs are pretty limited and the parser will
>>>>>>>>> expect them to only contain the following chars
>>>>>>>>> (A-Za-z0-9()+*.-_=,:;!~@%). You might try encoding the space as %20.
>>>>>>>>>
>>>>>>>>> Can you paste in the message from the logs? It should have more
>>>>>>>>> information (I hope). Also, what version of EB?
>>>>>>>>> -AZ
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Aug 2, 2010 at 12:30 PM, Adrian Fish
>>>>>>>>> <a.fish at lancaster.ac.uk>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>> Hi All,
>>>>>>>>>>
>>>>>>>>>> Has anybody encountered this with entity broker before? If you pass
>>>>>>>>>> a
>>>>>>>>>> site
>>>>>>>>>> id with spaces to any of the site entity custom actions you get
>>>>>>>>>> this
>>>>>>>>>> returned:
>>>>>>>>>>
>>>>>>>>>> Could not process entity: /site (400)[null]: Cannot execute custom
>>>>>>>>>> action
>>>>>>>>>> (pages) for request method GET, The custom action view key (show)
>>>>>>>>>> must
>>>>>>>>>> match
>>>>>>>>>> the request view key (list)
>>>>>>>>>>
>>>>>>>>>> How can I fix this? It's urgent, so if somebody can point me to the
>>>>>>>>>> right
>>>>>>>>>> place in the code and I'll sort it.
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>>
>>>>>>>>>> Adrian.
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> ==================================
>>>>>>>>>> Adrian Fish
>>>>>>>>>> Software Engineer
>>>>>>>>>> Centre for e-Science
>>>>>>>>>> Bowland Tower South C Floor
>>>>>>>>>> Lancaster University
>>>>>>>>>> Lancaster
>>>>>>>>>> LA1 4YW
>>>>>>>>>> email: a.fish at lancaster.ac.uk
>>>>>>>>>>
>>>>>>>>>> http://confluence.sakaiproject.org/display/YAFT/Yaft
>>>>>>>>>> http://confluence.sakaiproject.org/display/CLOG/Home
>>>>>>>>>> http://confluence.sakaiproject.org/display/BBB/Home
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> sakai-dev mailing list
>>>>>>>>>> sakai-dev at collab.sakaiproject.org
>>>>>>>>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>>>>>>>>>
>>>>>>>>>> TO UNSUBSCRIBE: send email to
>>>>>>>>>> sakai-dev-unsubscribe at collab.sakaiproject.org
>>>>>>>>>> with a subject of "unsubscribe"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>>                   
>>>>>>>> --
>>>>>>>> ==================================
>>>>>>>> Adrian Fish
>>>>>>>> Software Engineer
>>>>>>>> Centre for e-Science
>>>>>>>> Bowland Tower South C Floor
>>>>>>>> Lancaster University
>>>>>>>> Lancaster
>>>>>>>> LA1 4YW
>>>>>>>> email: a.fish at lancaster.ac.uk
>>>>>>>>
>>>>>>>> http://confluence.sakaiproject.org/display/YAFT/Yaft
>>>>>>>> http://confluence.sakaiproject.org/display/CLOG/Home
>>>>>>>> http://confluence.sakaiproject.org/display/BBB/Home
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>               
>>>>>> --
>>>>>> ==================================
>>>>>> Adrian Fish
>>>>>> Software Engineer
>>>>>> Centre for e-Science
>>>>>> Bowland Tower South C Floor
>>>>>> Lancaster University
>>>>>> Lancaster
>>>>>> LA1 4YW
>>>>>> email: a.fish at lancaster.ac.uk
>>>>>>
>>>>>> http://confluence.sakaiproject.org/display/YAFT/Yaft
>>>>>> http://confluence.sakaiproject.org/display/CLOG/Home
>>>>>> http://confluence.sakaiproject.org/display/BBB/Home
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>
>>>>>           
>>>> --
>>>> ==================================
>>>> Adrian Fish
>>>> Software Engineer
>>>> Centre for e-Science
>>>> Bowland Tower South C Floor
>>>> Lancaster University
>>>> Lancaster
>>>> LA1 4YW
>>>> email: a.fish at lancaster.ac.uk
>>>>
>>>> http://confluence.sakaiproject.org/display/YAFT/Yaft
>>>> http://confluence.sakaiproject.org/display/CLOG/Home
>>>> http://confluence.sakaiproject.org/display/BBB/Home
>>>>
>>>>
>>>>
>>>>         
>>>
>>>
>>>       
>> --
>> ==================================
>> Adrian Fish
>> Software Engineer
>> Centre for e-Science
>> Bowland Tower South C Floor
>> Lancaster University
>> Lancaster
>> LA1 4YW
>> email: a.fish at lancaster.ac.uk
>>
>> http://confluence.sakaiproject.org/display/YAFT/Yaft
>> http://confluence.sakaiproject.org/display/CLOG/Home
>> http://confluence.sakaiproject.org/display/BBB/Home
>>
>>
>>     
>
>
>
>   

-- 
==================================
Adrian Fish
Software Engineer
Centre for e-Science
Bowland Tower South C Floor
Lancaster University
Lancaster
LA1 4YW
email: a.fish at lancaster.ac.uk

http://confluence.sakaiproject.org/display/YAFT/Yaft
http://confluence.sakaiproject.org/display/CLOG/Home
http://confluence.sakaiproject.org/display/BBB/Home




 

###
UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 4500. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.

###
 


More information about the sakai-dev mailing list