Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: third_party/logilab/common/pyro_ext.py

Issue 739393004: Revert "Revert "pylint: upgrade to 1.3.1"" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/logilab/common/pdf_ext.py ('k') | third_party/logilab/common/pytest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. 1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
3 # 3 #
4 # This file is part of logilab-common. 4 # This file is part of logilab-common.
5 # 5 #
6 # logilab-common is free software: you can redistribute it and/or modify it unde r 6 # logilab-common is free software: you can redistribute it and/or modify it unde r
7 # the terms of the GNU Lesser General Public License as published by the Free 7 # the terms of the GNU Lesser General Public License as published by the Free
8 # Software Foundation, either version 2.1 of the License, or (at your option) an y 8 # Software Foundation, either version 2.1 of the License, or (at your option) an y
9 # later version. 9 # later version.
10 # 10 #
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return daemon 111 return daemon
112 112
113 def get_object_uri(qnsid): 113 def get_object_uri(qnsid):
114 return _PYRO_OBJS[qnsid] 114 return _PYRO_OBJS[qnsid]
115 115
116 def ns_unregister(nsid, defaultnsgroup=_MARKER, nshost=None): 116 def ns_unregister(nsid, defaultnsgroup=_MARKER, nshost=None):
117 """unregister the object with the given nsid from the pyro name server""" 117 """unregister the object with the given nsid from the pyro name server"""
118 nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup) 118 nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup)
119 try: 119 try:
120 nsd = locate_ns(nshost) 120 nsd = locate_ns(nshost)
121 except errors.PyroError, ex: 121 except errors.PyroError as ex:
122 # name server not responding 122 # name server not responding
123 _LOGGER.error('can\'t locate pyro name server: %s', ex) 123 _LOGGER.error('can\'t locate pyro name server: %s', ex)
124 else: 124 else:
125 try: 125 try:
126 nsd.unregister('%s.%s' % (nsgroup, nsid)) 126 nsd.unregister('%s.%s' % (nsgroup, nsid))
127 _LOGGER.info('%s unregistered from pyro name server', nsid) 127 _LOGGER.info('%s unregistered from pyro name server', nsid)
128 except errors.NamingError: 128 except errors.NamingError:
129 _LOGGER.warning('%s not registered in pyro name server', nsid) 129 _LOGGER.warning('%s not registered in pyro name server', nsid)
130 130
131 131
(...skipping 20 matching lines...) Expand all
152 152
153 def ns_get_proxy(nsid, defaultnsgroup=_MARKER, nshost=None): 153 def ns_get_proxy(nsid, defaultnsgroup=_MARKER, nshost=None):
154 """ 154 """
155 if nshost is None, the nameserver is found by a broadcast. 155 if nshost is None, the nameserver is found by a broadcast.
156 """ 156 """
157 # resolve the Pyro object 157 # resolve the Pyro object
158 nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup) 158 nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup)
159 try: 159 try:
160 nsd = locate_ns(nshost) 160 nsd = locate_ns(nshost)
161 pyrouri = nsd.resolve('%s.%s' % (nsgroup, nsid)) 161 pyrouri = nsd.resolve('%s.%s' % (nsgroup, nsid))
162 except errors.ProtocolError, ex: 162 except errors.ProtocolError as ex:
163 raise errors.PyroError( 163 raise errors.PyroError(
164 'Could not connect to the Pyro name server (host: %s)' % nshost) 164 'Could not connect to the Pyro name server (host: %s)' % nshost)
165 except errors.NamingError: 165 except errors.NamingError:
166 raise errors.PyroError( 166 raise errors.PyroError(
167 'Could not get proxy for %s (not registered in Pyro), ' 167 'Could not get proxy for %s (not registered in Pyro), '
168 'you may have to restart your server-side application' % nsid) 168 'you may have to restart your server-side application' % nsid)
169 return core.getProxyForURI(pyrouri) 169 return core.getProxyForURI(pyrouri)
170 170
171 def get_proxy(pyro_uri): 171 def get_proxy(pyro_uri):
172 """get a proxy for the passed pyro uri without using a nameserver 172 """get a proxy for the passed pyro uri without using a nameserver
173 """ 173 """
174 return core.getProxyForURI(pyro_uri) 174 return core.getProxyForURI(pyro_uri)
175 175
176 def set_pyro_log_threshold(level): 176 def set_pyro_log_threshold(level):
177 pyrologger = logging.getLogger('Pyro.%s' % str(id(util.Log))) 177 pyrologger = logging.getLogger('Pyro.%s' % str(id(util.Log)))
178 # remove handlers so only the root handler is used 178 # remove handlers so only the root handler is used
179 pyrologger.handlers = [] 179 pyrologger.handlers = []
180 pyrologger.setLevel(level) 180 pyrologger.setLevel(level)
OLDNEW
« no previous file with comments | « third_party/logilab/common/pdf_ext.py ('k') | third_party/logilab/common/pytest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698