[PonyORM-list] to_json and to_dict ssems to unable to work with	partial selections
    Вадим Бажов 
    vadim at ideco.ru
       
    Fri Jan  2 12:51:29 UTC 2015
    
    
  
Suppose we have a table of Codes and Customers. Each code can belong to 
exactly one customer.
For example, this works fine, giving me a json representation of a whole 
object with all relation onjects if any:
     rcodeid = '3'
     rcode = to_json(select(r for r in Rcodes if r.id == rcodeid))
But if i try to select particular fields from table, like this:
     rcode = to_json(select((r.id,r.code) for r in Rcodes if r.id == rcodeid))
i get an exception:
(<type 'exceptions.TypeError'>, TypeError('not all arguments converted 
during string formatting',), <traceback object at 0x8ff648c>)
The situation with to_dict is exactly the same. Works fine with full 
entities, throws an exception with partial selections.
Didn't find any notice in docs and blog that to_dict and to_json works 
only with complete entities. So enlighten me please if it's me doing 
something wrong or Pony ))
Thank you for the to_json method - it's very usefull.
    
    
More information about the ponyorm-list
mailing list