Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
GetTor Project
gettor
Commits
a0c4cae5
Commit
a0c4cae5
authored
Jul 01, 2014
by
ilv
Browse files
Eliminated stack inspect. Implemented a rather simple solution: ask for the service that called.
parent
2378e110
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core_demo.py
View file @
a0c4cae5
...
...
@@ -7,7 +7,7 @@ import gettor
try
:
core
=
gettor
.
Core
(
'gettor.cfg'
)
links
=
core
.
get_links
(
'linux'
,
'e
n
'
)
links
=
core
.
get_links
(
'dummy service'
,
'linux'
,
'e
s
'
)
print
links
except
ValueError
as
e
:
print
"Value error: "
+
str
(
e
)
...
...
src/gettor.py
View file @
a0c4cae5
...
...
@@ -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."
%
(
s
tr
(
module
)
,
operating_system
,
locale
))
(
s
ervice
,
operating_system
,
locale
))
if
locale
not
in
self
.
supported_locales
:
self
.
logger
.
warning
(
"Request for unsupported locale: %s"
%
locale
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment