Problem getting auth.wiki('slug', env=dict(mytest=...)) to work in a view?

38 views
Skip to first unread message

Chuck Paulson

unread,
Nov 5, 2013, 4:58:15 PM11/5/13
to web...@googlegroups.com
In a simple test app I have defined a controller, view, and wiki page. The idea is that the controller decides which wiki page to display (ex. 'slug'), and the view calls auth.wiki() to get the wiki page. The wiki page contains @{mytest:hi} which should be processed by the auth.wiki() call in the view.

The problem is that the @{mytest:hi} line in the wiki page does not do anything. It is as if the env argument to the auth.wiki() call in the view is ignored. Could someone tell me why this is? Is there is a workaround? Thanks.

The controller:

def test():
    return dict(myslug='slug')

The view:

{{extend 'layout.html'}}
<h1>This is the default/test.html template</h1>
{{=auth.wiki(myslug, env=dict(mytest=lambda x: "%s-%s" % (x,x)))}}
{{=BEAUTIFY(response._vars)}}

The 'slug':

## Slug
@{mytest:hi}
[[NEWLINE]]
page content

Chuck Paulson

unread,
Nov 8, 2013, 10:43:19 AM11/8/13
to web...@googlegroups.com
After further experimentation, it seems the default is for the wiki page to get processed once when you submit it after editing. Further auth.wiki calls on that slug just retrieve the computed html, they do not do processing, hence the env argument is ignored. There is a force_render flag which would reprocess the wiki page, but of course that slows down page retrieval. Anyway, its working now and I wanted to let everyone know the answer.

Dave S

unread,
Nov 8, 2013, 9:04:41 PM11/8/13
to web...@googlegroups.com
On Friday, November 8, 2013 7:43:19 AM UTC-8, Chuck Paulson wrote:
After further experimentation, it seems the default is for the wiki page to get processed once when you submit it after editing. Further auth.wiki calls on that slug just retrieve the computed html, they do not do processing, hence the env argument is ignored. There is a force_render flag which would reprocess the wiki page, but of course that slows down page retrieval. Anyway, its working now and I wanted to let everyone know the answer.


Thanks for the update!  Good work to track it down yourself.

/dps
 

Alan Etkin

unread,
Nov 9, 2013, 5:12:49 AM11/9/13
to web...@googlegroups.com
After further experimentation, it seems the default is for the wiki page to get processed once when you submit it after editing. Further auth.wiki calls on that slug just retrieve the computed html, they do not do processing, hence the env argument is ignored.

Do you think this is a bug in auth.wiki? Perhaps you can file an issue at

http://code.google.com/p/web2py/issues

Reply all
Reply to author
Forward
0 new messages