Attachment 'Ad.py'

Download

   1 """
   2     MoinMoin - Advertisement Macro (link to Amazon, B&N, etc)
   3 
   4     Usage: [[Ad(type)]]
   5 
   6     @copyright: 2006 by Osvaldo Santana Neto <osantana@gmail.com>
   7     @license:   GNU GPL, see COPYING for details
   8 """
   9 
  10 import random
  11 
  12 ads = {
  13 	'250x250': [
  14 		u"""__put your 250x250 advertisement html here__""",
  15 	],
  16 	'468x60': [
  17 		u"""__put your 468x60 advertisement html here__""",
  18 		u"""__put other 468x60 advertisement html here__""",
  19 	],
  20 }
  21 
  22 def execute(macro, arg):
  23     f = macro.formatter
  24     result = ''
  25     if arg:
  26         arg = arg.strip()
  27 
  28     if arg in ads:
  29         return random.choice(ads[arg])
  30 
  31     return f.strong(1) + f.text('Example: [[Ad(type)]]') + f.strong(0) + f.text(' - banner type.')

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-01-03 20:15:57, 0.7 KB) [[attachment:Ad.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.