record tips

来源:互联网 发布:长江证券mac版本下载 编辑:程序博客网 时间:2024/06/05 00:36

有很多olso的 包,东西很多,下面有个官方的wiki总结

https://wiki.openstack.org/wiki/Oslo#oslo.i18n

至于每一个的用法还是需要看细节

oslo.i18n

http://docs.openstack.org/developer/oslo.i18n/usage.html

http://blog.csdn.net/zwhfyy/article/details/1649043

oslo.i18n 封装了 gettext因此i18n.install 类似gettext.install,i18n.install('ironic')指定翻译(转换)的主目录

_translators = i18n.TranslatorFactory(domain='ironic')

# The primary translation function using the well-known name "_"
_ = _translators.primary

# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
--------------------------------------------------------------

__all__属性

有两句话说的比较好:

在模块(*.py)中使用意为导出__all__列表里的类、函数、变量等成员,否则将导出modualA中所有不以下划线开头(私有)的成员,在模块中使用__all__属性可避免在相互引用时的命名冲突


在模块(*.py)中使用意为导出__all__列表里的类、函数、变量等成员,否则将导出modualA中所有不以下划线开头(私有)的成员,在模块中使用__all__属性可避免在相互引用时的命名冲突


------------------------------------------------------------------

__name__属性

”每个模块都有一个内置的变量__name__。在模块自己运行的时候,该__name__就等于'main',而如果被其他的模块import,则该模块的__name__就等于模块名,也就是文件名去掉py扩展名的部分“

-----------------------------------------------------------------

oslo_config.cfg (oslo.config,两个都可以,oslo_config更新一些,推荐使用oslo_config)

此人对oslo.config进入了深入的分析,讲的不错,也包含argparser的讲解,借用一下

http://www.choudan.net/2013/11/27/OpenStack-Oslo.config-%E5%AD%A6%E4%B9%A0%28%E4%B8%80%29.html


待续。。。

2015.1版的ironic中使用了FSM,2014.2版的没有



0 0
原创粉丝点击