This is my ORM class definition:
#=========================
class User(Base):
__tablename__ = 'b_taa_user'
user_id = Column(Integer, primary_key=True, autoincrement=True,
nullable=False) # 用户ID
user_name = Column(Unicode(255), unique=True, nullable=False,
server_default="") # 用户名称
user_password = Column(Unicode(255), nullable=False,
server_default="") # 用户密码
email = Column(Unicode(255), nullable=False, server_default="") # 邮
箱
mobile = Column(Unicode(255), nullable=False, server_default="") #
手机
phone = Column(Unicode(255), nullable=False, server_default="") # 电
话
def __init__(self, user_name = ""):
self.user_name = username
#=========================
I made some debug by the code below:
#=========================
#!/usr/bin/python
import xmlrpclib
from blf.model import User
u = User('333')
s = xmlrpclib.dumps((u,), methodresponse=True, allow_none=True)
print s
#=========================
Finally, I found that the first problem is : xmlrpclib only serialize
type *instance*.
But to my surprise, when I check type of u, it's a *class* object.
Don't know why ...
On Mar 18, 6:50 pm, Noah Gift <[email protected]> wrote:
> On Wed, Mar 18, 2009 at 11:46 PM, 一首诗 <[email protected]> wrote:
>
> > Hi,
>
> > I am trying to pass SqlAlchemy objects to client with XML RPC, but it
> > seems that that's not very easy.
>
> It depends on what you are trying to do, and what error messages you are
> getting, for anyone to help. I am using XML RPC with SQLAlchemy right now,
> and I am, in fact, passing objects in. I wrote a metaclass that calls back
> to XML RPC, and takes the ugly nested dictionary and returns back a nifty
> class pre-populated with attributes I need to fill out. When I set each
> attribute, it then populates __dict__. At that point, I simply pass that
> back to XML RPC. Works great.
>
>
>
> > The reason why I have to do this is that my client is written in
> > javascript and running on a web page. So it could not use anything
> > other than text based protocols, such as XML RPC, SOAP, or JSON.
>
> > I tried pyamf, and it works pretty good with SA, but I can't use amf
> > with javascript.
>
> > Is there any possible solutions with my problem?
>
> --
> Cheers,
>
> Noah
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---