index.py
changeset 20 3feaac71738a
parent 19 0187eddad3eb
child 21 945f5a8cfefb
equal deleted inserted replaced
19:0187eddad3eb 20:3feaac71738a
    20 
    20 
    21 from PIL import Image, ImageDraw, ImageFont, ImageEnhance
    21 from PIL import Image, ImageDraw, ImageFont, ImageEnhance
    22 from cStringIO import StringIO
    22 from cStringIO import StringIO
    23 import random, itertools, time, os.path
    23 import random, itertools, time, os.path
    24 
    24 
       
    25 # monkeypatch 2.5 to add missing 2.6 features
    25 if not hasattr(itertools, 'izip_longest') :
    26 if not hasattr(itertools, 'izip_longest') :
    26   
       
    27     def izip_longest(*args, **kwds):
    27     def izip_longest(*args, **kwds):
    28         # izip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-
    28         # izip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-
    29         fillvalue = kwds.get('fillvalue')
    29         fillvalue = kwds.get('fillvalue')
    30         def sentinel(counter = ([fillvalue]*(len(args)-1)).pop):
    30         def sentinel(counter = ([fillvalue]*(len(args)-1)).pop):
    31             yield counter()         # yields the fillvalue, or raises IndexError
    31             yield counter()         # yields the fillvalue, or raises IndexError
    38             pass
    38             pass
    39     
    39     
    40     itertools.izip_longest = izip_longest 
    40     itertools.izip_longest = izip_longest 
    41     
    41     
    42 class Defaults :
    42 class Defaults :
    43     # settings
    43     """
       
    44         Default values for parameters
       
    45     """
    44 
    46 
    45     text_lang = 'en'
    47     text_lang = 'en'
    46 
    48 
    47     chars = [ u'"', u'!', u'?' ]
    49     chars = [ u'"', u'!', u'?' ]
    48 
    50 
   580         <div id='logo'>
   582         <div id='logo'>
   581             <a href="%(img_url)s"><img src="%(img_url)s" alt="Aaltologo" /></a>
   583             <a href="%(img_url)s"><img src="%(img_url)s" alt="Aaltologo" /></a>
   582         </div>
   584         </div>
   583         <div id='info'>
   585         <div id='info'>
   584             <h1>Aaltologotin</h1>
   586             <h1>Aaltologotin</h1>
   585             <p>Aaltologotin pulauttaa sulle uuden, sattumanvaraisesti valitun aalto-logon!</p>
   587             <p>Aaltologotin pulauttaa sinulle uuden, sattumanvaraisesti valitun aalto-logon!</p>
   586             
   588             
   587             <form action="%(script_url)s" method="POST">
   589             <form action="%(script_url)s" method="POST">
   588                 <fieldset>
   590                 <fieldset>
   589                     <legend>Aalto-parameterit</legend>
   591                     <legend>Aalto-parameterit</legend>
   590 %(form_fields)s
   592 %(form_fields)s