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(" + url[4:] + ")")

This was my first solution, it works well with args and vars.
This case works, tested against:
Home url:'homepage','plugin_wiki','index'
Articles page:articles
Links url:'homepage','default','links'
Test url:'f',args=['x','y'],vars=dict(z='t')
Projects url:'f',args=['x','y']

Generated:
http://127.0.0.1:8000/homepage/plugin_wiki/index
http://127.0.0.1:8000/homepage/plugin_wiki/page/articles
http://127.0.0.1:8000/homepage/default/links
http://127.0.0.1:8000/homepage/plugin_wiki/f/x/y?z=t
http://127.0.0.1:8000/homepage/plugin_wiki/f/x/y


The only small gotcha is white space absence being required because of
the regular expression being used to "parse" the meta-menu lines...

On Jan 4, 1:13 pm, blackthorne <francisco....@gmail.com> wrote:
> 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 <mdipie...@cs.depaul.edu> 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 <francisco....@gmail.com> 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:
> > > home url:'homepage','plugin_wiki','index'
>
> > > you will get:
> > > In [9]: url="url:\'homepage\',\'plugin_wiki\',\'index\'"
>
> > > In [10]: [part.strip('\'') for part in url[4:].split(',')]
> > > Out[10]: ['homepage', 'plugin_wiki', 'index']
>
> > > In [11]: [part for part in url[4:].split(',')]
> > > Out[11]: ["'homepage'", "'plugin_wiki'", "'index'"]
>
> > > Best regards
>
> > > On Jan 4, 11:49 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > 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?
>
> > > > On Jan 3, 9:07 pm, blackthorne <francisco....@gmail.com> wrote:
>
> > > > > 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%20wik...
>
> > > > > thank you
>
> > > > > On Jan 4, 2:51 am, Francisco Gama <blacktho...@ironik.org> wrote:
>
> > > > > > this patch allows you to define custom links using the URL() helper 
> > > > > > in the meta-menu of plugin_wiki, so you should apply it to:
> > > > > > models/plugin_wiki.py
>
> > > > > > the syntax used is "Title url:URL_args"
>
> > > > > > example:
> > > > > > home url:'homepage','plugin_wiki','index'
> > > > > > Articles page:articles
> > > > > > Links url:'homepage','default','links'
>
> > > > > > notice that after "url:" you shall not leave white spaces. This is 
> > > > > > a must not to touch in the regex currently being used to match that
>
> > > > > > Other idea, would be to bring this power to markmin links...
>
> > > > > > Leave comments,
> > > > > > Best regards
>
> > > > > > Francisco Gama Tabanez Ribeiro
>
> > > > > > E-mail: blacktho...@ironik.org
> > > > > > Twitter: blackthorne

Reply via email to