(See below)

On Friday, February 21, 2014 9:38:36 AM UTC-8, Austin Taylor wrote:
>
> I tried using this answer located here:
>
> http://stackoverflow.com/questions/9679090/using-modules-in-views/9680031#9680031
>
> Here is the response i'm trying to follow (so you don't have to click the 
> link).
>
> -----------------
>
> Just for record.
>
> It is not a good idea to use locals()
>
> instead of passing locals to response.render, it is better to create a 
> dictionary with the keys you want to be available for the view to be 
> rendered.
>
> You can also include a reference to markdown on that dictionary
>
> from gluon.contrib.markdown.markdown2 import markdown
> mydict = dict(markdown=markdown, anotherkey=anothervalue)return 
> response.render("path/to/view", mydict)
>
> Dont try to extend locals() in to mydict, you will run in to problems if 
> you try this.
>
> Also you can just use the default web2py behavior
>
> from gluon.contrib.markdown.markdown2 import markdown
> response.view = "path/to/view"return dict(markdown=markdown, 
> anotherkey=anothervalue)
>
> another option for you is to import markdown in a model file.
>
> ---------------------------
>
>
> What does he mean by anotherkey=anothervalue? 
>
I think he's just using these as placeholders (or non-specific examples).   
If your queryDict (below) has {dailyPrice = $4.50, orderQuantity = 5, 
shipping='surface'},
then you'd write mydict=dict(markdown=markdown, price2use=dailyPrice), or 
mydict=dict(markdown=markdown, price2use=dailyPrice, 
quantity=orderQuantity), etc.

Sorry, I can't answer anything markdown-related, though, as I am also 
pretty much a noob as well.  (To my credit, one rather simple app used as 
an intranet-based datalogger.)

 

> If my dictionary is called queryDict and I have a lot of values I'd like 
> to be returned how could I return them all using markdown?
>
> Sorry if this is noobish, I love web2py and am trying to use it for 
> everything.
>
>
(And I've been hanging out in this group for several months, so I can 
sometimes parrot an answer.)

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to