本文整理汇总了Python中meresco.components.json.JsonDict.dumps方法的典型用法代码示例。如果您正苦于以下问题:Python JsonDict.dumps方法的具体用法?Python JsonDict.dumps怎么用?Python JsonDict.dumps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meresco.components.json.JsonDict
的用法示例。
在下文中一共展示了JsonDict.dumps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dna
# 需要导入模块: from meresco.components.json import JsonDict [as 别名]
# 或者: from meresco.components.json.JsonDict import dumps [as 别名]
def dna(reactor, port, dataPath, logPath, statePath, harvesterStatusUrl, **ignored):
harvesterData = HarvesterData(dataPath)
repositoryStatus = be((RepositoryStatus(logPath, statePath),
(harvesterData,)
))
configDict = JsonDict(
logPath=logPath,
statePath=statePath,
harvesterStatusUrl=harvesterStatusUrl,
dataPath=dataPath,
)
return \
(Observable(),
(ObservableHttpServer(reactor, port),
(ApacheLogger(stdout),
(PathFilter("/info/version"),
(StringServer(VERSION_STRING, ContentTypePlainText), )
),
(PathFilter("/info/config"),
(StringServer(configDict.dumps(), ContentTypeJson), )
),
(PathFilter("/static"),
(PathRename(lambda name: name[len('/static/'):]),
(FileServer(seecrWebLibPath),)
)
),
(PathFilter('/', excluding=['/info/version', '/info/config', '/static', '/action', '/get']),
(DynamicHtml(
[dynamicHtmlPath],
reactor=reactor,
additionalGlobals = {
'time': time,
'harvesterStatusUrl': harvesterStatusUrl,
'escapeXml': escapeXml,
'compose': compose,
},
indexPage="/index.html",
),
(harvesterData,),
(repositoryStatus,),
)
),
(PathFilter('/action'),
(HarvesterDataActions(),
(harvesterData,)
),
),
(PathFilter('/get'),
(HarvesterDataRetrieve(),
(harvesterData,),
(repositoryStatus,),
)
)
)
)
)
示例2: dna
# 需要导入模块: from meresco.components.json import JsonDict [as 别名]
# 或者: from meresco.components.json.JsonDict import dumps [as 别名]
def dna(reactor, port, dataPath, logPath, statePath, externalUrl, **ignored):
passwordFilename = join(dataPath, 'users.txt')
harvesterData = HarvesterData(dataPath)
repositoryStatus = be(
(RepositoryStatus(logPath, statePath),
(harvesterData, )
)
)
configDict = JsonDict(
logPath=logPath,
statePath=statePath,
externaUrl=externalUrl,
dataPath=dataPath,
)
passwordFile = PasswordFile(filename=passwordFilename)
basicHtmlLoginHelix = (BasicHtmlLoginForm(
action="/login.action",
loginPath="/login",
home="/index",
rememberMeCookie=False,
lang="nl"),
(passwordFile, )
)
userActions = UserActions(dataDir=dataPath)
userActionsHelix = (userActions,
(passwordFile, )
)
return \
(Observable(),
(ObservableHttpServer(reactor, port),
(ApacheLogger(stdout),
(BasicHttpHandler(),
(SessionHandler(),
(CookieMemoryStore(name="meresco-harvester", timeout=2*60*60), ),
(PathFilter("/info/version"),
(StringServer(VERSION_STRING, ContentTypePlainText), )
),
(PathFilter("/info/config"),
(StringServer(configDict.dumps(), ContentTypeJson), )
),
(PathFilter('/login.action'),
basicHtmlLoginHelix
),
(PathFilter('/user.action'),
userActionsHelix
),
(PathFilter("/static"),
(PathRename(lambda name: name[len('/static/'):]),
(FileServer([seecrWebLibPath, staticHtmlPath]),)
)
),
(PathFilter('/', excluding=['/info/version', '/info/config', '/static', '/action', '/get', '/login.action', '/user.action']),
(SecureZone("/login", excluding="/index", defaultLanguage="nl"),
(DynamicHtml(
[dynamicHtmlPath],
reactor=reactor,
additionalGlobals={
'externalUrl': externalUrl,
'escapeXml': escapeXml,
'compose': compose,
'VERSION': VERSION,
'CONFIG': configDict,
'Timeslot': Timeslot,
'ThroughputAnalyser': ThroughputAnalyser,
'dateSince': dateSince,
'callable': callable,
'OnlineHarvest': OnlineHarvest,
'StringIO': StringIO,
'okPlainText': okPlainText,
'ZuluTime': ZuluTime,
'xpathFirst': xpathFirst,
},
indexPage="/index",
),
basicHtmlLoginHelix,
(harvesterData,),
(repositoryStatus,),
userActionsHelix,
)
)
),
(PathFilter('/action'),
(HarvesterDataActions(),
(harvesterData,)
),
),
(PathFilter('/get'),
(HarvesterDataRetrieve(),
(harvesterData,),
(repositoryStatus,),
)
)
)
)
)
)
#.........这里部分代码省略.........