Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
beb4b39b
Commit
beb4b39b
authored
May 08, 2013
by
Steve Strassmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix logging
parent
dc473e6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
23 deletions
+10
-23
i18n/extract.py
+3
-3
i18n/generate.py
+3
-3
i18n/logger.py
+0
-13
i18n/tests/test_validate.py
+4
-4
No files found.
i18n/extract.py
View file @
beb4b39b
...
@@ -15,11 +15,10 @@ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow
...
@@ -15,11 +15,10 @@ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow
"""
"""
import
os
import
os
,
sys
,
logging
from
datetime
import
datetime
from
datetime
import
datetime
from
polib
import
pofile
from
polib
import
pofile
from
logger
import
get_logger
from
config
import
BASE_DIR
,
LOCALE_DIR
,
CONFIGURATION
from
config
import
BASE_DIR
,
LOCALE_DIR
,
CONFIGURATION
from
execute
import
execute
,
create_dir_if_necessary
,
remove_file
from
execute
import
execute
,
create_dir_if_necessary
,
remove_file
...
@@ -34,7 +33,8 @@ BABEL_OUT = BASE_DIR.relpathto(CONFIGURATION.source_messages_dir.joinpath('mako.
...
@@ -34,7 +33,8 @@ BABEL_OUT = BASE_DIR.relpathto(CONFIGURATION.source_messages_dir.joinpath('mako.
SOURCE_WARN
=
'This English source file is machine-generated. Do not check it into github'
SOURCE_WARN
=
'This English source file is machine-generated. Do not check it into github'
def
main
():
def
main
():
log
=
get_logger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
logging
.
basicConfig
(
stream
=
sys
.
stdout
,
level
=
logging
.
INFO
)
create_dir_if_necessary
(
LOCALE_DIR
)
create_dir_if_necessary
(
LOCALE_DIR
)
source_msgs_dir
=
CONFIGURATION
.
source_messages_dir
source_msgs_dir
=
CONFIGURATION
.
source_messages_dir
...
...
i18n/generate.py
View file @
beb4b39b
...
@@ -13,10 +13,9 @@
...
@@ -13,10 +13,9 @@
languages to generate.
languages to generate.
"""
"""
import
os
import
os
,
sys
,
logging
from
polib
import
pofile
from
polib
import
pofile
from
logger
import
get_logger
from
config
import
BASE_DIR
,
CONFIGURATION
from
config
import
BASE_DIR
,
CONFIGURATION
from
execute
import
execute
,
remove_file
from
execute
import
execute
,
remove_file
...
@@ -72,7 +71,8 @@ def validate_files(dir, files_to_merge):
...
@@ -72,7 +71,8 @@ def validate_files(dir, files_to_merge):
raise
Exception
(
"I18N: Cannot generate because file not found: {0}"
.
format
(
pathname
))
raise
Exception
(
"I18N: Cannot generate because file not found: {0}"
.
format
(
pathname
))
def
main
():
def
main
():
log
=
get_logger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
logging
.
basicConfig
(
stream
=
sys
.
stdout
,
level
=
logging
.
INFO
)
for
locale
in
CONFIGURATION
.
locales
:
for
locale
in
CONFIGURATION
.
locales
:
merge
(
locale
)
merge
(
locale
)
...
...
i18n/logger.py
deleted
100644 → 0
View file @
dc473e6f
import
logging
def
get_logger
(
name
):
"""
Returns a default logger.
logging.basicConfig does not render to the console
"""
log
=
logging
.
getLogger
()
log
.
setLevel
(
logging
.
INFO
)
log_handler
=
logging
.
StreamHandler
()
log_handler
.
setFormatter
(
logging
.
Formatter
(
'
%(asctime)
s [
%(levelname)
s]
%(message)
s'
))
log
.
addHandler
(
log_handler
)
return
log
i18n/tests/test_validate.py
View file @
beb4b39b
import
os
import
os
,
sys
,
logging
from
unittest
import
TestCase
from
unittest
import
TestCase
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
from
logger
import
get_logger
from
config
import
LOCALE_DIR
from
config
import
LOCALE_DIR
from
execute
import
call
from
execute
import
call
...
@@ -10,10 +9,11 @@ def test_po_files(root=LOCALE_DIR):
...
@@ -10,10 +9,11 @@ def test_po_files(root=LOCALE_DIR):
"""
"""
This is a generator. It yields all of the .po files under root, and tests each one.
This is a generator. It yields all of the .po files under root, and tests each one.
"""
"""
log
=
get_logger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
logging
.
basicConfig
(
stream
=
sys
.
stdout
,
level
=
logging
.
INFO
)
for
(
dirpath
,
dirnames
,
filenames
)
in
os
.
walk
(
root
):
for
(
dirpath
,
dirnames
,
filenames
)
in
os
.
walk
(
root
):
for
name
in
filenames
:
for
name
in
filenames
:
print
name
(
base
,
ext
)
=
os
.
path
.
splitext
(
name
)
(
base
,
ext
)
=
os
.
path
.
splitext
(
name
)
if
ext
.
lower
()
==
'.po'
:
if
ext
.
lower
()
==
'.po'
:
yield
validate_po_file
,
os
.
path
.
join
(
dirpath
,
name
),
log
yield
validate_po_file
,
os
.
path
.
join
(
dirpath
,
name
),
log
...
...
Write
Preview
Markdown
is supported
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