Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 844889 Details for
Bug 1048140
Support logging XMLRPC method's namespace
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
git patch for supporting logging XMLRPC method's namespace
0001-Support-logging-XMLRPC-method-s-namespace.patch (text/plain), 2.92 KB, created by
cqi
on 2014-01-03 09:37:25 UTC
(
hide
)
Description:
git patch for supporting logging XMLRPC method's namespace
Filename:
MIME Type:
Creator:
cqi
Created:
2014-01-03 09:37:25 UTC
Size:
2.92 KB
patch
obsolete
>From 314d220b86167fe663e7e4a61080d64ed0573439 Mon Sep 17 00:00:00 2001 >From: Chenxiong Qi <cqi@redhat.com> >Date: Fri, 3 Jan 2014 17:01:58 +0800 >Subject: [PATCH] Support logging XMLRPC method's namespace > >log_call method accepts parameter named namespace, that allows developer to >specify specific namespace within which a XMLRPC method is being called. For >example, > >@log_call(namespace='testplan') >def get(request, id): > pass > >As a result, the method field of model XmlRpcLog in the database will contain >`testplan.get`. >--- > kobo/django/xmlrpc/decorators.py | 51 +++++++++++++++++++++++----------------- > 1 file changed, 29 insertions(+), 22 deletions(-) > >diff --git a/kobo/django/xmlrpc/decorators.py b/kobo/django/xmlrpc/decorators.py >index abd5a7f..4783178 100644 >--- a/kobo/django/xmlrpc/decorators.py >+++ b/kobo/django/xmlrpc/decorators.py >@@ -72,28 +72,35 @@ def validate_user(func): > return _new_func > > >-def log_call(function): >- def _new_function(request, *args, **kwargs): >- try: >- argspec = inspect.getargspec(function) >- arg_names = argspec[0][1:] >- known_args = zip(arg_names, args) >- unknown_args = list(enumerate(args[len(arg_names):])) >- keyword_args = [ (key, value) for key, value in kwargs.iteritems() if (key, value) not in known_args ] >- >- log = XmlRpcLog() >- log.user = request.user >- log.method = function.__name__ >- log.args = str(known_args + unknown_args + keyword_args) >- log.save() >- except: >- pass >- return function(request, *args, **kwargs) >- >- _new_function.__name__ = function.__name__ >- _new_function.__doc__ = function.__doc__ >- _new_function.__dict__.update(function.__dict__) >- return _new_function >+def log_call(*args, **kwargs): >+ namespace = kwargs.get('namespace', '') >+ if namespace: >+ namespace = namespace + '.' >+ >+ def decorator(function): >+ def _new_function(request, *args, **kwargs): >+ try: >+ argspec = inspect.getargspec(function) >+ arg_names = argspec[0][1:] >+ known_args = zip(arg_names, args) >+ unknown_args = list(enumerate(args[len(arg_names):])) >+ keyword_args = [ (key, value) for key, value in kwargs.iteritems() if (key, value) not in known_args ] >+ >+ log = XmlRpcLog() >+ log.user = request.user >+ log.method = '%s%s' % (namespace, function.__name__) >+ log.args = str(known_args + unknown_args + keyword_args) >+ log.save() >+ except: >+ pass >+ return function(request, *args, **kwargs) >+ >+ _new_function.__name__ = function.__name__ >+ _new_function.__doc__ = function.__doc__ >+ _new_function.__dict__.update(function.__dict__) >+ return _new_function >+ >+ return decorator > > > @decorator_with_args >-- >1.8.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1048140
: 844889