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


Python JsonDict.dumps方法代码示例

本文整理汇总了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,),
                        )
                    )
                )
            )
        )
开发者ID:,项目名称:,代码行数:59,代码来源:

示例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,),
                                )
                            )
                        )
                    )
                )
            )
#.........这里部分代码省略.........
开发者ID:seecr,项目名称:meresco-harvester,代码行数:103,代码来源:server.py


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