[Moin-user] SQL Queries in Moin

Robert Groenewegen robert.groenewegen at tiscali.nl
Thu Oct 30 23:22:09 EST 2003


Hi Paul,

I have attached a script from my own wiki which may help you. The scripts shows SQL in python, the dataset, and some things you may want to return. Don't know what you exactly need but the script may save you time ... 

FYI The script is used to build an overview (table) with the issues on my project. The issues (wiki pages) are in the wiki, the overview (all issues with dates and so on) are in mysql database. (BTW I have not added the line _=macro.gettext yet)

Have fun, Robert



 On Sun, 26 Oct 2003 18:53:15 +0000, Paul Moore wrote:
> 
> >[[SQL("select * from emp")]]
> 
> 2 hours work at max.
> 
> >I'm assuming I'd probably have to write this myself,
> 
> Maybe a little more if you have to get aquainted. :)
> 
> We'll give you some hints.
> 
> > as I suspect that
> >writing macros available? I've searched the MoinMoin site, but can't
> >see anything (other than stuff in the MacroMarket that I can try to
> >learn from).
> 
> Start at the MoinDev page. Add any things you learn, then we'll have 
> more complete developer docs some day.
> 
> >This is getting a bit away from "collaborative website" and more into
> >"web application" areas, so maybe MoinMoin isn't a good tool for this.
> 
> While I warn people to press moin into niches where other tools a WAY 
> better (say, bug tracking), it is a good idea to create BRIDGES to other 
> systems (e.g. bug report macros, probably you'll see Bugzilla support in 
> the future). So adding ER modelling to moin is probably stupid, SQL 
> selects are not.
> 
> >1. I need to get the username/password/database somewhere. Can I store
> >   them externally to the page, or am I better just adding 3 more
> >   parameters to the macro?
> 
> Just add them to moin_config.py. Use a special prefix though, like 
> macro_sql_*.
> 
> >2. As I'm getting data from the database, it might be nice to password
> >   protect the page. Is there any sort of Moin or Apache trick to
> >   require authentication on particular Wiki pages?
> 
> Current CVS or upcoming release (#acl).
> 
> >3. Should I do this some other way altogether?
> 
> Not really. Do me a favour and make the thing DBAPI 2.0 compatible, and 
> use __import__ to load the dbapi module, so that it's also configurable 
> in moin_config. If you do that, expect to find SQL.py added to the 
> distribution.
> 
> Use MoinMoin/macro/ShowSmileys.py as a template for SQL.py. As for docs 
> on writing macros, just look at the existing ones. It really _IS_ easy, 
> and often enough you don't need to know much about the rest of the moin 
> source.
> 
> I had Python newbies write macros after 2 days with moin & python.
> 
> 
> Ciao, Jürgen
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?   SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Moin-user mailing list
> Moin-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/moin-user
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ShowIssues.py
Type: application/octet-stream
Size: 1385 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/moin-user/attachments/20031030/4d7ed4d8/attachment.obj>


More information about the Moin-user mailing list