[mod_python] unsupported format character '"' (0x22) at index 30

Lee jundong leejd80 at gmail.com
Wed Dec 15 10:17:30 EST 2004


I find a matter.In case of using "%" symbol to link string,like:print
str1%str2.It can't work  with Modpython.But it can work ok with pure
python.How to do it?
My code is:
--------------welcome.py------------------
def welcome (req):
    content = """
<table border="0" width="100%">
  <tr>
    <td width="15%" valign="top">%s<!--Menu-->
    </td>
    <td width="85%" valign="top">WELCOME!</td>
  </tr>
</table>
"""
    return content%frame.Menu()
--------------frame.py----------------
def Menu ():
    content = """
    <table border="1" width="100%">
        <tr>
          <td width="100%"><a href="../user.py/Show">User Management</a></td>
        </tr>
        <tr>
          <td width="100%"><a href="../custom.py/Show">Custom
Management</a></td>
        </tr>
        <tr>
          <td width="100%">Group Management</td>
        </tr>
        <tr>
          <td width="100%"><a href="../sendsms.py/Ready">Send SMS</a></td>
        </tr>
      </table>
"""
    return content
-----------------------------------
The above code execute result is :

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "E:\Zope\Python\Lib\site-packages\mod_python\apache.py", line
299, in HandlerDispatch
    result = object(req)

  File "E:\Zope\Python\Lib\site-packages\mod_python\publisher.py",
line 136, in handler
    result = util.apply_fs_data(object, req.form, req=req)

  File "E:\Zope\Python\Lib\site-packages\mod_python\util.py", line
361, in apply_fs_data
    return object(**args)

  File "E:/Project/GridGate/Source/sms\welcome.py", line 19, in welcome
    return content%frame.Menu()

ValueError: unsupported format character '"' (0x22) at index 30


-- 
My Blog >> http://leejd.cndev.org
My QQ >> 9847243


More information about the Mod_python mailing list