Closed sommobilitat closed 6 years ago
I think you missinterpreted the usage of those classes. user
must be a key in your system. UserInfo is a custom class you MUST implement to get those fields from your own ERP. The YAML based implementation of UserInfo used in the example should be used JUST for demo purposes. Please, don't dump all your users in yaml! Don't read yaml files on every query like that class does.
Indeed all the components in red in the following diagram should be custom classes that have to be reimplemented:
Common classes like Catalog
and IntercoopApi
have constructors that receive instances of the reimplementable classes they rely on. Example and tests inject dummy classes, but, in production you should inject instances of your own production ready classes.
@sommobilitat I added our workinprogress implementation of user info in python/intercoop/userinfo.py so you can take it as reference.
While implementing intercoop to sommobilitat, we faced that almost every request has a different user, so it would better to instead of saving the user info to a
yaml
file, we could pass a simple namespace object, so we avoid saving the file and loading it later.So, a simple example of how it could be used would be: