[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [gettor/master] Eliminated stack inspect. Implemented a rather simple solution: ask for the service that called.



commit a0c4cae583c292432d74a248be6ba11a6dd78da9
Author: ilv <ilv@xxxxxxxxxxxxxxxxxxxxxxxx>
Date:   Tue Jul 1 23:59:33 2014 -0400

    Eliminated stack inspect. Implemented a rather simple solution: ask for the service that called.
---
 src/core_demo.py |    2 +-
 src/gettor.py    |    8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/core_demo.py b/src/core_demo.py
index d30f2a4..c783517 100644
--- a/src/core_demo.py
+++ b/src/core_demo.py
@@ -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)
diff --git a/src/gettor.py b/src/gettor.py
index e2321c1..d5492cd 100644
--- a/src/gettor.py
+++ b/src/gettor.py
@@ -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)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits