发掘odoo.cli.server.Server的秘密,OpenERP的第三根线头儿

command.py调用了server command

在server.py中,主函数main使用了外层模块传递来的args

 1 def main(args):
 2     check_root_user()
 3     odoo.tools.config.parse_config(args)
 4     check_postgres_user()
 5     report_configuration()
 6
 7     config = odoo.tools.config
 8
 9     # the default limit for CSV fields in the module is 128KiB, which is not
10     # quite sufficient to import images to store in attachment. 500MiB is a
11     # bit overkill, but better safe than sorry I guess
12     csv.field_size_limit(500 * 1024 * 1024)
13
14     preload = []
15     if config[‘db_name‘]:
16         preload = config[‘db_name‘].split(‘,‘)
17         for db_name in preload:
18             try:
19                 odoo.service.db._create_empty_database(db_name)
20             except odoo.service.db.DatabaseExists:
21                 pass
22
23     if config["translate_out"]:
24         export_translation()
25         sys.exit(0)
26
27     if config["translate_in"]:
28         import_translation()
29         sys.exit(0)
30
31     # This needs to be done now to ensure the use of the multiprocessing
32     # signaling mecanism for registries loaded with -d
33     if config[‘workers‘]:
34         odoo.multi_process = True
35
36     stop = config["stop_after_init"]
37
38     setup_pid_file()
39     rc = odoo.service.server.start(preload=preload, stop=stop)
40     sys.exit(rc)

其中line 2 check_root_user仅针对posix系统 暂时忽略

1 def check_root_user():
2     """Warn if the process‘s user is ‘root‘ (on POSIX system)."""
3     if os.name == ‘posix‘:
4         import pwd
5         if pwd.getpwuid(os.getuid())[0] == ‘root‘:
6             sys.stderr.write("Running as user ‘root‘ is a security risk.\n")
时间: 2024-08-03 16:03:10

发掘odoo.cli.server.Server的秘密,OpenERP的第三根线头儿的相关文章

odoo.cli.main()指的是哪里?OpenERP的第二根线头儿

接上回,odoo-bin中调用了odoo.cli.main(),去哪儿找? cli目录容易找 跟随__init__.py的脚步 1 import logging 2 import sys 3 import os 4 5 import odoo 6 7 from command import Command, main 8 9 import deploy 10 import scaffold 11 import server 12 import shell 13 import start see

odoo.cli.main()做了什么?

先把代码贴过来 1 def main(): 2 args = sys.argv[1:] 3 4 # The only shared option is '--addons-path=' needed to discover additional 5 # commands from modules 6 if len(args) > 1 and args[0].startswith('--addons-path=') and not args[1].startswith("-"):

CentOS 7.x里yum安装Odoo 8.0&9.0(OpenERP)

(总结)CentOS 7.x里yum安装Odoo 8.0&9.0(OpenERP) 最近想了解下合适中小企业使用的ERP系统,研究了几款主流的开源ERP系统以及了解下SAP.Oracle EBS等大型ERP系统,开源ERP里Odoo(以前叫OpenERP)是最有名的,听说在欧洲广泛使用.功能确实非常强大,默认有中文语言包,使用Python开发,数据库用了PostgreSQL,缺点是不支持MySQL.官方有yum源,在CentOS 7.x里使用yum安装部署比较快速,但如果稍不注意细节,可能就会安

ODOO从哪里开始??OpenERP的线头儿

Windows下ODOO源码启动: python odoo-bin -w odoo -r odoo --addons-path=addons,../mymodules --db-filter=mydb$ 其中的odoo-bin 其实也是一个python文件,内容很短 1 #!/usr/bin/env python 2 __import__('pkg_resources').declare_namespace('odoo.addons') 3 import odoo 4 5 if __name__

【LR11】Error -27796: Failed to connect to server"server:port": [10060] Connection timed out错误解决办法

  场景描述:被测系统是发布在远程服务器上的,假设IP是10.10.10.10,端口是8066,那么访问地址是http://10.10.10.10:8066/,在control机器上我设置了IP欺骗. 错误现象:在场景运行时出现大量Action.c(8): Error -27796: Failed to connect to server"server:port": [10060] Connection timed out错误. 官方的troubleshooting: 查看工具的tro

[Vs Code]Vue工具错误(The Vue Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.)

错误:The Vue Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. 在使用VSCODE的时候,因为电脑异常关机,重新打开VSCODE的时候,显示这个错误,错误导致我的vue类型文件无法格式化和智能提示. Vetur的错误,解决方案为:https://github.com/vuejs/vetur/issues/352 来自插件作者:Go to C:\Us

Cannot start server. Server instance is not configured.

今天在myeclipse中建立虚拟目录的时候不小心物理路径中出现了中文,出现了服务器无法启动的问题 控制台还提示utf1~8字节... 所以编码过程中涉及路径的最好不要出现中文,在将文件上传到服务器过程中被编码的话就无法将文件正常写到磁盘. 版权声明:本文为博主原创文章,未经博主允许不得转载.如需转载,请注明出处:http://blog.csdn.net/lindonglian

ubuntu server激活即时通讯IM服务 Instant Messaging is not activated on this server

转自:http://shine-it.net/index.php/topic,16469.msg28364.html ubuntu server 下 odoo激活及时通讯功能im OpenERP IM Odoo IM activated "Instant Messaging is not activated on this server." 参考: https://accounts.openerp.com/forum/Help-1/question/How-to-activate-ch

SQL Server快速生成SQL增删改查语句

你还在手敲代码生成SQL语句吗?你还在为因为马虎出错的SQL语句而感到无语吗?你还在为不知怎样表达复杂的SQL语句而纠结吗?如果你的回答为"是",那你就OUT啦,快来试试应用SQL Server资源管理器快速生成SQL语句吧. 首先,打开SQL Server2008,在菜单栏"查询"下拉菜单中找到"在编辑器中设计查询",如下图: 在打开的查询设计器窗口中添加要进行操作的数据库表. 在添加的表内下方空白部分右键单击鼠标,在弹出菜单中单击"