Commits

Stéphane Wirtel committed 84a6575

[IMP] Add an example in the setup.py file

  • Participants
  • Parent commits b1c9b53

Comments (0)

Files changed (1)

 -------------
 
 This extension allows to use the OpenERP server with Flask
+
+#!/usr/bin/env python
+from flask import Flask
+from flaskext.openerp import OpenERP
+
+class DefaultConfig(object):
+    OPENERP_PROTOCOL = 'netrpc'
+    OPENERP_HOSTNAME = 'localhost'
+    OPENERP_DATABASE = 'openerp'
+    OPENERP_DEFAULT_USERNAME = 'admin'
+    OPENERP_DEFAULT_PASSWORD = 'admin'
+    OPENERP_PORT = 8070
+
+    SECRET_KEY = 'secret_key'
+
+    DEBUG = True
+
+app = Flask(__name__)
+app.config.from_object(DefaultConfig())
+OpenERP(app)
+
+@app.route('/')
+def index():
+    proxy = Object(g.openerp_cnx, 'res.users')
+    users = proxy.select([], ['name', 'login'])
+
+    return str(users)
+
+app.run()
 """
 
 from setuptools import setup