~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/lazr/doc/utils.txt

  • Committer: Steve Kowalik
  • Date: 2011-09-13 05:23:16 UTC
  • mto: This revision was merged to the branch mainline in revision 13939.
  • Revision ID: stevenk@ubuntu.com-20110913052316-hl7fzgsklq9jakwq
Chip away at canonical.lazr a little more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
LAZR provides a way of converting TextThatIsWordSeparatedWithInterCaps
7
7
to text_that_is_word_separated_with_underscores.
8
8
 
9
 
    >>> from canonical.lazr.utils import camelcase_to_underscore_separated
 
9
    >>> from lazr.restful.utils import camelcase_to_underscore_separated
10
10
    >>> camelcase_to_underscore_separated('lowercase')
11
11
    'lowercase'
12
12
    >>> camelcase_to_underscore_separated('TwoWords')
27
27
caller. This behaviour of the builtin hasattr() is annoying because it
28
28
makes problems harder to diagnose.
29
29
 
30
 
    >>> from canonical.lazr.utils import safe_hasattr
 
30
    >>> from lazr.restful.utils import safe_hasattr
31
31
 
32
32
    >>> class Oracle(object):
33
33
    ...     @property
58
58
smartquote() converts pairs of inch marks (") in a string to typographical
59
59
quotation marks.
60
60
 
61
 
    >>> from canonical.lazr.utils import smartquote
 
61
    >>> from lazr.restful.utils import smartquote
62
62
    >>> smartquote('')
63
63
    u''
64
64
    >>> smartquote('foo "bar" baz')
82
82
This will escape the given text so that it can be used in Javascript
83
83
code.
84
84
 
85
 
    >>> from canonical.lazr.utils import safe_js_escape
 
85
    >>> from lazr.restful.utils import safe_js_escape
86
86
    >>> print safe_js_escape('John "nasty" O\'Brien')
87
87
    "John "nasty" O'Brien"
88
88
    >>> print safe_js_escape("John O\'Brien")