本文整理汇总了Python中dispatcher.Dispatcher.register_function方法的典型用法代码示例。如果您正苦于以下问题:Python Dispatcher.register_function方法的具体用法?Python Dispatcher.register_function怎么用?Python Dispatcher.register_function使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dispatcher.Dispatcher
的用法示例。
在下文中一共展示了Dispatcher.register_function方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TypedForm
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import register_function [as 别名]
if http_request.POST:
form = TypedForm(signatures_names[1:], params, http_request.POST)
if form.is_valid():
d = form.cleaned_data
from xmlrpclib import ServerProxy
server = ServerProxy('http://%s:%s/xmlrpc/' % (http_request.META['REMOTE_ADDR'], http_request.META['SERVER_PORT']))
mmethod = getattr(server, 'method_name')
print d
result = mmethod(**d)
else:
form = TypedForm(signatures_names[1:], params)
return render_to_response('xmlrpc/method_test.html', locals(),
context_instance=RequestContext(http_request))
dispatcher = Dispatcher()
try:
try:
module = __import__('metaweblog', globals(), locals(), [])
except ImportError, error:
#if 'no module named xmlrpc' in str(error).lower():
raise
for name, item in module.__dict__.items():
if hasattr(item, '_signature'):
function_name = '%s' % (name)
dispatcher.register_function(item, function_name)
except ImportError, error:
pass