On 2017-07-18 08:49, [email protected] wrote:
> Hi,
> 
> I found in party/tests/test_party a json syntax to pass data to populate a 
> model with proteus,

This is not json, it is Python dict and it does not use proteus.

> but I see a « keys error » when trying to use it:
> 
> Python 2.7.13 (default, Apr 23 2017, 16:56:24) 
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from proteus import config, Model, Wizard
> >>> def set_config(database, user, config_file=None):
> ...     return config.set_trytond(database, user, config_file=config_file)
> ... 
> >>> config = set_config(u't44_4', u'admin', 
> >>> '/Users/jcm/Sites/_tryton/tryton4.4/my_local_trytond.conf')
> >>> Party = Model.get('party.party')
> >>> party1, = Party.create([{
> ...                     'name': 'Party 1',
> ...                     }])
> Traceback (most recent call last):
>   File "<stdin>", line 2, in <module>
>   File "/Users/jcm/Sites/_tryton/tryton4.4/proteus/proteus/config.py", line 
> 169, in __call__
>     rpc.convert(self._object, *args)
>   File "/Users/jcm/Sites/_tryton/tryton4.4/trytond/trytond/rpc.py", line 36, 
> in convert
>     for key in context.keys():
> AttributeError: 'list' object has no attribute ‘keys'

You can call methods using proteus but then you need to pass as last
parameter the context.
But it is not the way proteus is supposed to be used, you are supposed
to instantiate Models and call .save()

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20170718072921.GN30717%40kei.

Reply via email to