Re: Macros and Caching
Finn Smith <[email protected]>
| Newsgroups | gmane.comp.web.wiki.moin.devel |
|---|---|
| Message-ID | <[email protected]> |
On Apr 13, 2004, at 4:58 AM, Florian Festi wrote: > > As already stated the Dependencies variable can tell what the macro > depends on. This allows MoinMoin to deside if it has to be executed or > not. "time" simply means it has to be executed every time. MoinMoin is > supposed to use ["time"] as default if Dependencies is not given within > the macro. If that doesn't work (I did not yet verify) this is a bug. It turns out this was my mistake. I copied the [[BR]] macro which has this line at the top: Dependencies = [] I should have just commented it out. Both this: # Dependencies = [] and this: Dependencies = ["time"] work fine for me. >> Last question: Currently I have three files for my macro, based on the >> way the UserPreferences macro is set up: MoinMoin/macro/UserLogin.py >> (displays the form), MoinMoin/action/UserLogin.py (performs the >> login/logout logic) and MoinMoin/userlogin.py (contains all the actual >> code and is loaded and executed by the other two). Can anyone give >> feedback as to whether this is the "right" way to organize my code? Is >> there any way to encapsulate this all in one file in one place? > > For me this look good. You cannot avoid haveing at least the action and > the macro file. YOu could move the content of MoinMoin/userlogin.py > into > one of both and import this file from the other (via "from > MoinMoin.action.userlogin import myfunction" in 1.1 and > wikiutil.importPlugin in 1.2). This has pros and cons: > > * no file in MoinMoin -> can go into data/plugins > * not that nice > * not compatible between 1.1 and 1.2 I ended up putting everything into macro/UserLoginForm.py and action/UserLogin.py. This has the advantage of separating the form generation code entirely from the actual logic of logging someone in or out, so that action can be used elsewhere. -F ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click