当前位置: 首页>>代码示例>>Python>>正文


Python Site.settings["own"]方法代码示例

本文整理汇总了Python中Site.Site.settings["own"]方法的典型用法代码示例。如果您正苦于以下问题:Python Site.settings["own"]方法的具体用法?Python Site.settings["own"]怎么用?Python Site.settings["own"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Site.Site的用法示例。


在下文中一共展示了Site.settings["own"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: siteCreate

# 需要导入模块: from Site import Site [as 别名]
# 或者: from Site.Site import settings["own"] [as 别名]
    def siteCreate(self):
        logging.info("Generating new privatekey...")
        from Crypt import CryptBitcoin
        privatekey = CryptBitcoin.newPrivatekey()
        logging.info("----------------------------------------------------------------------")
        logging.info("Site private key: %s" % privatekey)
        logging.info("                  !!! ^ Save it now, required to modify the site ^ !!!")
        address = CryptBitcoin.privatekeyToAddress(privatekey)
        logging.info("Site address:     %s" % address)
        logging.info("----------------------------------------------------------------------")

        while True and not config.batch:
            if raw_input("? Have you secured your private key? (yes, no) > ").lower() == "yes":
                break
            else:
                logging.info("Please, secure it now, you going to need it to modify your site!")

        logging.info("Creating directory structure...")
        from Site import Site
        from Site import SiteManager
        SiteManager.site_manager.load()

        os.mkdir("%s/%s" % (config.data_dir, address))
        open("%s/%s/index.html" % (config.data_dir, address), "w").write("Hello %s!" % address)

        logging.info("Creating content.json...")
        site = Site(address)
        site.content_manager.sign(privatekey=privatekey, extend={"postmessage_nonce_security": True})
        site.settings["own"] = True
        site.saveSettings()

        logging.info("Site created!")
开发者ID:TheBojda,项目名称:ZeroNet,代码行数:34,代码来源:main.py

示例2: siteCreate

# 需要导入模块: from Site import Site [as 别名]
# 或者: from Site.Site import settings["own"] [as 别名]
def siteCreate():
	logging.info("Generating new privatekey...")
	from Crypt import CryptBitcoin
	privatekey = CryptBitcoin.newPrivatekey()
	logging.info("----------------------------------------------------------------------")
	logging.info("Site private key: %s" % privatekey)
	logging.info("                  !!! ^ Save it now, required to modify the site ^ !!!")
	address = CryptBitcoin.privatekeyToAddress(privatekey)
	logging.info("Site address:     %s" % address)
	logging.info("----------------------------------------------------------------------")

	while True:
		if raw_input("? Have you secured your private key? (yes, no) > ").lower() == "yes": break
		else: logging.info("Please, secure it now, you going to need it to modify your site!")

	logging.info("Creating directory structure...")
	from Site import Site
	os.mkdir("data/%s" % address)
	open("data/%s/index.html" % address, "w").write("Hello %s!" % address)

	logging.info("Creating content.json...")
	site = Site(address)
	site.content_manager.sign(privatekey=privatekey)
	site.settings["own"] = True
	site.saveSettings()

	logging.info("Site created!")
开发者ID:M0Dark,项目名称:ZeroNet,代码行数:29,代码来源:main.py


注:本文中的Site.Site.settings["own"]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。