[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-07 Thread blackthorne
thanks, that must have been the only line of code I haven't really thought about On Jan 7, 5:36 pm, Jonathan Lundell wrote: > On Jan 7, 2011, at 9:26 AM, blackthorne wrote: > > > > > ok, after some work, here's the patch. > > Massimo, I tried to follow your way, hope you like it. > > The code is

Re: [web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 9:26 AM, blackthorne wrote: > > ok, after some work, here's the patch. > Massimo, I tried to follow your way, hope you like it. > The code is made in non strict way, so it shouldn't break at the first > non valid input. > > URL() in meta-menu plugin_wiki patch: > http://www.spe

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-07 Thread blackthorne
ok, after some work, here's the patch. Massimo, I tried to follow your way, hope you like it. The code is made in non strict way, so it shouldn't break at the first non valid input. URL() in meta-menu plugin_wiki patch: http://www.speedyshare.com/files/26117790/url-in-meta-menu_plugin_wiki.patch

Re: [web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-05 Thread Jonathan Lundell
On Jan 5, 2011, at 2:25 AM, blackthorne wrote: > > ok > > What about the menu option "/Computer /option", wouldn it be caught by > the same regex currently used? I haven't been following this thread too closely, but all this stuff should be fine in vars. Question marks, slashes, spaces--all oug

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-05 Thread blackthorne
ok What about the menu option "/Computer /option", wouldn it be caught by the same regex currently used? On Jan 5, 1:07 am, mdipierro wrote: > No it would not because ? is not allowed in args. > > On Jan 4, 5:58 pm, blackthorne wrote: > > > > > there I'm just giving you counter-examples that m

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
No it would not because ? is not allowed in args. On Jan 4, 5:58 pm, blackthorne wrote: > there I'm just giving you counter-examples that may break that > notation. > On your second question, the / on the right of = would be an argument > 'a' with '/Computer /option' just without quotes as they a

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
there I'm just giving you counter-examples that may break that notation. On your second question, the / on the right of = would be an argument 'a' with '/Computer /option' just without quotes as they are optional. Making a regular expression for that seems very hard, a real parser would be required

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
I do not understand the notation you propose. Are you suggesting a= to specify args? Why the / on the right of =? On Jan 4, 3:55 pm, blackthorne wrote: > what if? >   menu item             path               possible arg > /Computer_option     /path/function?a=/Computer /option > /Computer /optio

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
what if? menu item path possible arg /Computer_option /path/function?a=/Computer /option /Computer /option /path/function?a='/Computer /option' /Computer_option page:computer I'm complicating, I know but I'm sure that could find more realistic examples t

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
I mean page_name /controller/action/arg1/arg2?a='Hello Computer'&b=5 page_name /controller/action/arg1/arg2?a=Hello+Computer&b=5 Should be equivalent. So the code should: 0) If path starts with / 1) use regex to find "'(?P.*(? wrote: > sure, I'm just not sure what you mean with optional quotes. >

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
sure, I'm just not sure what you mean with optional quotes. e.g.: page_name /controller/action/arg1/arg2?a='Welcome page2' /Computers /controller/action/arg1/arg2?a=Hello Computer should become: page_name -> /controller/action/arg1/arg2?a='Welcome page2' /Computers -> /controller/action/arg1/arg2

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
I think we can go this way: page_name /controller/action/arg1/arg2?a='Welcome page2' but I would make so that the quotes optional (if provided content will be replaced by urllib.quote(content). Would you send me a revised patch? On Jan 4, 11:21 am, blackthorne wrote: > Well, I see your v

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
Well, I see your view. In some cases, you can just use %20 instead of white space but not if that is part of the argument. example: http://prernalal.com/banned%20books/ == http://prernalal.com/banned books/ - valid http://example.com/?page="banned%20books"; != http://example.com/?page="banned book

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
This is a big can of worms... Do we really need to pass vars? On Jan 4, 10:45 am, blackthorne wrote: > sorry, I was considering on using the same code to the wiki pages in > the markmin syntax so that you could also make this kind of links in > wiki pages. > [[namehttp://example.com, args=[], var

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
sorry, I was considering on using the same code to the wiki pages in the markmin syntax so that you could also make this kind of links in wiki pages. [[name http://example.com, args=[], vars={}]] Other thing, you might want to consider... check your example page_name /controller/action/arg1/arg2?a

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
Are we still talking about menu links? Why should a menu item perform a post? On Jan 4, 10:31 am, blackthorne wrote: > fine with me > > any solution for POST method? > > On Jan 4, 4:25 pm, mdipierro wrote: > > > I have no objection to local URL.  but the author of the menu may not > > be the adm

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
fine with me any solution for POST method? On Jan 4, 4:25 pm, mdipierro wrote: > I have no objection to local URL.  but the author of the menu may not > be the administrator therefore we cannot eval(...) text in the meta- > menu. This poses restrictions on what we can put in there. I suggest >

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
I have no objection to local URL. but the author of the menu may not be the administrator therefore we cannot eval(...) text in the meta- menu. This poses restrictions on what we can put in there. I suggest we just allow page_name /controller/action/arg1/arg2?a=b and if this starts with / this i

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
no local urls for secure mode... yes/no? On Jan 4, 3:51 pm, mdipierro wrote: > There cannot be eval in there. The plugin may be in level=1 (secure > mode). > > On Jan 4, 8:38 am, blackthorne wrote: > > > > > Broken here: > > In [21]: url="\'f\',args=[\'x\',\'y\'],vars=dict(z=\'t\')" > > > In [22

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
There cannot be eval in there. The plugin may be in level=1 (secure mode). On Jan 4, 8:38 am, blackthorne wrote: > Broken here: > In [21]: url="\'f\',args=[\'x\',\'y\'],vars=dict(z=\'t\')" > > In [22]: [part.strip('\'').strip('\"') for part in url[4:].split(',')] > Out[22]: ["args=['x", "y']", "v

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
Broken here: In [21]: url="\'f\',args=[\'x\',\'y\'],vars=dict(z=\'t\')" In [22]: [part.strip('\'').strip('\"') for part in url[4:].split(',')] Out[22]: ["args=['x", "y']", "vars=dict(z='t')"] Just use: elif url.lower().startswith('url:'): url=eval("URL(" +

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
That way, you can use URL() to pass args [] and vars {} under the web2py way. Have to test it though... On Jan 4, 12:24 pm, mdipierro wrote: > but why not simply > > url:homepage/plugin_wiki/index > > or > > localurl:homepage/plugin_wiki/index > > and no quotes? > > On Jan 4, 6:00 am, blackthorne

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
but why not simply url:homepage/plugin_wiki/index or localurl:homepage/plugin_wiki/index and no quotes? On Jan 4, 6:00 am, blackthorne wrote: > instead of having common strings ready to be passed as arguments, you > would get strings that contain quotes in it. I guess... > > Consider my examp

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
maybe this would even be a better option: [part.strip('\'').strip('\"') for part in url[4:].split(',')] On Jan 4, 12:00 pm, blackthorne wrote: > instead of having common strings ready to be passed as arguments, you > would get strings that contain quotes in it. I guess... > > Consider my example:

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread blackthorne
instead of having common strings ready to be passed as arguments, you would get strings that contain quotes in it. I guess... Consider my example: home url:'homepage','plugin_wiki','index' you will get: In [9]: url="url:\'homepage\',\'plugin_wiki\',\'index\'" In [10]: [part.strip('\'') for part

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-04 Thread mdipierro
Why +elif url.lower().startswith('url:'): + url=URL(*[part.strip('\'') for part in url[4:].split(',')]) and not +elif url.lower().startswith('url:'): + url=URL(*[part for part in url[4:].split(',')]) Why the quotes?

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-03 Thread blackthorne
Because it may not be obvious that the previous message includes a patch, here is from another source: http://www.speedyshare.com/files/26051957/download/patch.plugin%20wiki%20url thank you On Jan 4, 2:51 am, Francisco Gama wrote: > this patch allows you to define custom links using the URL() he