diff options
author | Petr Viktorin <pviktori@redhat.com> | 2014-10-09 17:02:25 +0200 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2014-11-21 12:14:44 +0100 |
commit | b64f91fb437a1e05070053ae709903067eb5901d (patch) | |
tree | 04cb96eeed4675df6a3a3299cf2e7c36efa06961 /ipaserver/plugins | |
parent | 93c69b51278ef5a6b04047b7d38f619101d0d184 (diff) | |
download | freeipa-b64f91fb437a1e05070053ae709903067eb5901d.tar.gz freeipa-b64f91fb437a1e05070053ae709903067eb5901d.tar.xz freeipa-b64f91fb437a1e05070053ae709903067eb5901d.zip |
dogtag plugin: Don't use doctest syntax for non-doctest examples
https://fedorahosted.org/freeipa/ticket/4610
Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r-- | ipaserver/plugins/dogtag.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py index cd1c05cd5..52bdb0d42 100644 --- a/ipaserver/plugins/dogtag.py +++ b/ipaserver/plugins/dogtag.py @@ -163,16 +163,16 @@ Basic rules on handling these values 1. Reading a serial number from CMS requires conversion from hexadecimal by converting it into a Python int or long object, use the int constructor: - >>> serial_number = int(serial_number, 16) + serial_number = int(serial_number, 16) 2. Big integers passed to XMLRPC must be decimal unicode strings - >>> unicode(serial_number) + unicode(serial_number) 3. Big integers received from XMLRPC must be converted back to int or long objects from the decimal string representation. - >>> serial_number = int(serial_number) + serial_number = int(serial_number) Xpath pattern matching on node names: ------------------------------------- @@ -202,7 +202,7 @@ want to pass the node name. To do this use the name() function. One way we could solve the chapter problem above is by using a predicate which says if the node name begins with 'chapter' it's a match. Here is how you can do that. - >>> doc.xpath("//book/*[starts-with(name(), 'chapter')]/section[2]") + doc.xpath("//book/*[starts-with(name(), 'chapter')]/section[2]") The built-in starts-with() returns true if its first argument starts with its second argument. Thus the example above says if the node name of the second @@ -219,10 +219,10 @@ it to bind to those namespaces during its evaluation. Then we just use the EXSLT regular expression match() function on the node name. Here is how this is done: - >>> regexpNS = "http://exslt.org/regular-expressions" - >>> find = etree.XPath("//book/*[re:match(name(), '^chapter(_\d+)$')]/section[2]", - ... namespaces={'re':regexpNS} - >>> find(doc) + regexpNS = "http://exslt.org/regular-expressions" + find = etree.XPath("//book/*[re:match(name(), '^chapter(_\d+)$')]/section[2]", + namespaces={'re':regexpNS} + find(doc) What is happening here is that etree.XPath() has returned us an evaluator function which we bind to the name 'find'. We've passed it a set of namespaces |