Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions scripts/lang_sync
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ def setup_auth():
"""
Setup the authentication for connecting to Eints.
"""
global user_cfg

user, passwd = None, None

# Read the file if provided.
Expand Down Expand Up @@ -275,8 +273,6 @@ def build_url(suffix):
@param suffix: Path to retrieve from, at L{UserConfig.base_url}
@type suffix: C{str}
"""
global user_cfg

assert suffix[0] == "/"
if user_cfg.base_url[-1] == "/":
return user_cfg.base_url + suffix[1:]
Expand Down Expand Up @@ -420,7 +416,7 @@ def get_eints_languages():
@return: Available language information for the project as returned by Eints.
@rtype: C{list} of L{EintsLanguageInfo}
"""
global user_cfg, eints_files_cache
global eints_files_cache

if eints_files_cache is not None:
return eints_files_cache
Expand Down Expand Up @@ -498,7 +494,7 @@ def get_local_languages():
@return: Found language files.
@rtype: C{list} of L{LocalLanguageInfo}
"""
global user_cfg, local_files_cache
global local_files_cache

if local_files_cache is not None:
return local_files_cache
Expand Down Expand Up @@ -582,8 +578,6 @@ def perform_operation(op_type, lang_type, credits_handle):
@param credits_handle: If available, output stream for writing credits of language file changes.
@type credits_handle: C{file} or C{None}
"""
global user_cfg

if op_type == "create":
assert lang_type == "project"
# Project creation operation.
Expand Down Expand Up @@ -639,8 +633,6 @@ def perform_create_project():
"""
Create a new project in Eints.
"""
global user_cfg

assert user_cfg.project_desc is not None

if user_cfg.project_type not in KNOWN_PROJECT_TYPES:
Expand Down
2 changes: 0 additions & 2 deletions webtranslate/rights.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ def has_access(page, roles):
@return: Whether access is granted.
@rtype: C{bool}
"""
global _table

if "USER" not in roles:
roles = set(["SOMEONE"])

Expand Down
2 changes: 0 additions & 2 deletions webtranslate/users/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def authenticate(user, pwd):
@return: Whether the combination is valid (C{True} means 'valid').
@rtype: C{bool}
"""
global _users

if len(pwd) == 0:
return False
return (user, pwd) in _users
Expand Down
3 changes: 1 addition & 2 deletions webtranslate/users/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def init():
"""
Initialize the user admin system.
"""
global server, ldap_host
global server
import ldap3

rights.init_page_access()
Expand All @@ -89,7 +89,6 @@ def get_authentication(user, pwd):
# Note that failure to authenticate is not fatal, it falls back to an 'unknown' user.
groups = set()
if user is not None and user != "" and pwd is not None and pwd != "":
global server, ldap_basedn_users, ldap_basedn_groups
import ldap3

try:
Expand Down
9 changes: 2 additions & 7 deletions webtranslate/users/redmine.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def connect():
@return: Whether we are connected (not 100% certain).
@rtype: C{bool}
"""
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
global db_connection

if db_connection is not None:
return True # Already connected.
Expand Down Expand Up @@ -142,7 +142,7 @@ def _do_command(cmd, parms):
@return: Cursor with the result, if all went well, else C{None}
@rtype: db cursor, or C{None}
"""
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
global db_connection

if db_type == "postgress":
import psycopg2
Expand Down Expand Up @@ -176,8 +176,6 @@ def query(cmd, parms):
@return: Cursor with the result, if all went well, else C{None}
@rtype: db cursor, or C{None}
"""
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection

count = 0
while count < 3:
# Connect if not connected.
Expand Down Expand Up @@ -225,9 +223,6 @@ def get_authentication(user, pwd):
@return: UserAuthentication object to test accesses with.
@rtype: C{UserAuthentication}
"""
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
global owner_role, translator_roles

# Verify user.
# Note that failure to authenticate is not fatal, it falls back to an 'unknown' user.
if user is not None and user != "" and pwd is not None:
Expand Down