Ed Singleton wrote:
> I posted this to the TurboGears list, but I guess someone here might
> be better placed to help me:
>
> I get this error message when I try to save a new entry into my model.
>  I can't work out any useful information from it.
>
> Does anyone else have any ideas...
>   
You've passed in an object where a string (or, more precisely, a unicode
value, since encode is used to take unicode to string values) was
expected.  Looking in cgi.py, it's a FieldStorage instance.  You'll need
to get the *value* from that field storage (i.e. fs.value) before
attempting to store it.  You can, I believe, define a conversion using a
validator object in your controllers.py module.  I'm too new to TG to
give you much more help than that, but hopefully it will move you
forward somewhat.

HTH,
Mike
> Page handler: <bound method PostController.save of
> <wltm.controllers.PostController object at 0x0157C710>>
> Traceback (most recent call last):
>   
...
>  File 
> "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\main.py",
> line 1080, in set
>    kw[name] = dbValue = from_python(value, self._SO_validatorState)
>  File 
> "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\col.py",
> line 547, in from_python
>    return value.encode(self.db_encoding)
>  File "c:\Python24\lib\cgi.py", line 540, in __getattr__
>    raise AttributeError, name
> AttributeError: encode
>   
-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to