@register.tag
def lorem(parser, token):
 bits = list(token.split_contents())
 tagname = bits[0]
 common = (bits[(-1)] != 'random')
 if (not common):
  bits.pop()
 if (bits[(-1)] in ('w', 'p', 'b')):
  method = bits.pop()
 else:
  method = 'b'
 if (len(bits) > 1):
  count = bits.pop()
 else:
  count = '1'
 count = parser.compile_filter(count)
 if (len(bits) != 1):
  raise template.TemplateSyntaxError(('Incorrect format for %r tag' % tagname))
 return LoremNode(count, method, common)

@ register . tag def lorem ( parser , token ) : bits = list ( token . split_contents ( ) ) tagname = bits [ 0 ] common = ( bits [ ( - 1 ) ] != 'random' ) if ( not common ) : bits . pop ( ) if ( bits [ ( - 1 ) ] in ( 'w' , 'p' , 'b' ) ) : method = bits . pop ( ) else : method = 'b' if ( len ( bits ) > 1 ) : count = bits . pop ( ) else : count = '1' count = parser . compile_filter ( count ) if ( len ( bits ) != 1 ) : raise template . TemplateSyntaxError ( ( 'Incorrect format for %r tag' % tagname ) ) return LoremNode ( count , method , common )
creates random latin text useful for providing test data in templates .