Hi , i am sorry for my english, i am trying ti make a Server/Client
app. Until now client-gtk mapped the db and spoked directly with the
db ( sqlite and postgresql atm) . I wrote a small wsgi server based
on werkzeug, and it basically make the same thing of the client-gtk
but in pure web style. If received a request it render html with
template engine and response the html-code.
Now with client-gtk i am trying to use something like:
def getRecord(self,id=None):
""" Restituisce un record ( necessita di un ID )"""
if id:
params = {}
params["dao_class"] = self.DaoModule.__module__
params["dao_name"] = self.DaoModule.__name__
params["filter"] = id
params["method"] = "getRecord"
paramss = urllib.urlencode(params)
f = urllib.urlopen("http://localhost:8080/gtk", paramss)
dati_uncompress = zlib.decompress(f.read())
dati= loads(dati_uncompress)
return dati
It is for get.
Server side this is the function to handler:
def gtk_(req, static=None, SUB=None, subdomain=None):
values = req.form.to_dict()
dao_name = values["dao_name"]
dao_class = values["dao_class"]
method = values["method"]
filtri = values["filter"]
exec "from %s import %s" %(dao_class.replace("promogest", "core"),
dao_name)
if method =="select" or method =="getRecord":
exec "d = %s().%s(filtri=%s)" %(dao_name,method, filtri)
dumped = dumps(d)
if method=="nuovo":
exec "d = %s" %(dao_name)
dumped = dumps(d)
compressed = zlib.compress(dumped)
return Response(compressed)
""" exec create something like: User().getRecord(filter=22) """
For example for user table:
class User(Dao):
""" User class provides to make a Users dao""
def __init__(self, req=None,arg=None):
Dao.__init__(self, entity=self)
std_mapper = mapper(User,user, properties={
"per_giu" :relation(PersonaGiuridica_, backref='cliente_'),
}, order_by=user.c.username)
It works until i need to work with a new istance:
i don't know how to have an istance in the client , to build there or
have it from a response from the server.
SA serializer loads need a metadata and a session ... but i don't
have a db in the client ...
I suppose to use merge() server side, when i have to return the object
with the value assigned for each column client side ...
I hope to explained the problem sufficiently with my poor english ...
i need to know if it is a possible way to do.
thanks
F.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---