Anonymous avatar Anonymous committed 78d9216

[svn] fixed a few doctests not properly escaping their new lines and quoting their result

Comments (0)

Files changed (3)

webhelpers/rails/form_options.py

         >>> options_for_select([ "VISA", "MasterCard" ], "MasterCard")
         '<option value="VISA">VISA</option>\\n<option value="MasterCard" selected="selected">MasterCard</option>'
         >>> options_for_select(dict(Basic="$20", Plus="$40"), "$40")
-        <option value="$40" selected="selected">Plus</option>\n<option value="$20">Basic</option>
+        '<option value="$40" selected="selected">Plus</option>\\n<option value="$20">Basic</option>'
         >>> options_for_select([ "VISA", "MasterCard", "Discover" ], ["VISA", "Discover"])
         '<option value="VISA" selected="selected">VISA</option>\\n<option value="MasterCard">MasterCard</option>\\n<option value="Discover" selected="selected">Discover</option>'
 

webhelpers/rails/javascript.py

     Example::
     
         >>> javascript_tag("alert('All is good')")
-        '<script type="text/javascript">\n//<![CDATA[\nalert(\'All is good\')\n//]]>\n</script>'
+        '<script type="text/javascript">\\n//<![CDATA[\nalert(\'All is good\')\\n//]]>\n</script>'
     """
     return content_tag("script", javascript_cdata_section(content), type="text/javascript",
                        **html_options)

webhelpers/rails/urls.py

     Examples::
     
         >>> mail_to("me@domain.com", "My email", encode = "javascript")
-        '<script type="text/javascript">\n//<![CDATA[\neval(unescape(\'%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b\'))\n//]]>\n</script>'
+        '<script type="text/javascript">\\n//<![CDATA[\\neval(unescape(\'%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b\'))\n//]]>\\n</script>'
     
         >>> mail_to("me@domain.com", "My email", encode = "hex")
         '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d">My email</a>'
     Example::
         
         >>> js_obfuscate("<input type='hidden' name='check' value='valid' />")
-        '<script type="text/javascript">\n//<![CDATA[\neval(unescape(\'%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%69%6e%70%75%74%20%74%79%70%65%3d%27%68%69%64%64%65%6e%27%20%6e%61%6d%65%3d%27%63%68%65%63%6b%27%20%76%61%6c%75%65%3d%27%76%61%6c%69%64%27%20%2f%3e%27%29%3b\'))\n//]]>\n</script>'
+        '<script type="text/javascript">\\n//<![CDATA[\\neval(unescape(\'%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%69%6e%70%75%74%20%74%79%70%65%3d%27%68%69%64%64%65%6e%27%20%6e%61%6d%65%3d%27%63%68%65%63%6b%27%20%76%61%6c%75%65%3d%27%76%61%6c%69%64%27%20%2f%3e%27%29%3b\'))\\n//]]>\\n</script>'
     """
     tmp = "document.write('%s');" % data
     string = ''.join(['%%%x' % ord(x) for x in tmp])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.