~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/contrib/webdesign/lorem_ipsum.py

  • Committer: Package Import Robot
  • Author(s): Raphaël Hertzog
  • Date: 2014-09-17 14:15:11 UTC
  • mfrom: (1.3.17) (6.2.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140917141511-icneokthe9ww5sk4
Tags: 1.7-2
* Release to unstable.
* Add a migrate-south sample script to help users apply their South
  migrations. Thanks to Brian May.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        'adipisicing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', 'incididunt',
43
43
        'ut', 'labore', 'et', 'dolore', 'magna', 'aliqua')
44
44
 
 
45
 
45
46
def sentence():
46
47
    """
47
48
    Returns a randomly generated sentence of lorem ipsum text.
56
57
    # Convert to sentence case and add end punctuation.
57
58
    return '%s%s%s' % (s[0].upper(), s[1:], random.choice('?.'))
58
59
 
 
60
 
59
61
def paragraph():
60
62
    """
61
63
    Returns a randomly generated paragraph of lorem ipsum text.
62
64
 
63
65
    The paragraph consists of between 1 and 4 sentences, inclusive.
64
66
    """
65
 
    return ' '.join([sentence() for i in range(random.randint(1, 4))])
 
67
    return ' '.join(sentence() for i in range(random.randint(1, 4)))
 
68
 
66
69
 
67
70
def paragraphs(count, common=True):
68
71
    """
80
83
            paras.append(paragraph())
81
84
    return paras
82
85
 
 
86
 
83
87
def words(count, common=True):
84
88
    """
85
89
    Returns a string of `count` lorem ipsum words separated by a single space.