Commit a0c4cae5 authored by ilv's avatar ilv
Browse files

Eliminated stack inspect. Implemented a rather simple solution: ask for the service that called.

parent 2378e110
......@@ -7,7 +7,7 @@ import gettor
try:
core = gettor.Core('gettor.cfg')
links = core.get_links('linux', 'en')
links = core.get_links('dummy service', 'linux', 'es')
print links
except ValueError as e:
print "Value error: " + str(e)
......
......@@ -175,7 +175,7 @@ class Core(object):
logger.propagate = False
self.logger.debug("New core object created")
def get_links(self, operating_system, locale):
def get_links(self, service, operating_system, locale):
"""
Public method to obtain links.
......@@ -187,11 +187,9 @@ class Core(object):
(e.g. SMTP).
"""
# Figure out which module called us and what was asking for
caller = inspect.stack()[1]
module = inspect.getmodule(caller[0])
# Which module called us and what was asking for?
self.logger.info("%s did a request for %s, %s." %
(str(module), operating_system, locale))
(service, operating_system, locale))
if locale not in self.supported_locales:
self.logger.warning("Request for unsupported locale: %s" % locale)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment