Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
33f314da
Commit
33f314da
authored
Nov 03, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #66 from mruwek/fix-unicode-alias
Fix unicode values in aliases config in python2
parents
cb1cc42c
86c19606
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
2 deletions
+24
-2
setup.py
setup.py
+1
-0
test/TestGetSubCommand.py
test/TestGetSubCommand.py
+8
-0
test/data/aliases.conf
test/data/aliases.conf
+1
-0
topydo/lib/Config.py
topydo/lib/Config.py
+14
-2
No files found.
setup.py
View file @
33f314da
...
...
@@ -34,6 +34,7 @@ setup(
],
extras_require
=
{
':sys_platform=="win32"'
:
[
'colorama>=0.2.5'
],
':python_version=="2.7"'
:
[
'ushlex'
],
'ical'
:
[
'icalendar'
],
'prompt-toolkit'
:
[
'prompt-toolkit >= 0.53'
],
'edit-cmd-tests'
:
[
'mock'
],
...
...
test/TestGetSubCommand.py
View file @
33f314da
...
...
@@ -54,6 +54,14 @@ class GetSubcommandTest(TopydoTest):
self
.
assertTrue
(
issubclass
(
real_cmd
,
ListCommand
))
self
.
assertEqual
(
final_args
,
[
"-F"
,
"|I| x c d {(}p{)} s k"
,
"-n"
,
"25"
])
def
test_alias03
(
self
):
config
(
"test/data/aliases.conf"
)
args
=
[
"smile"
]
real_cmd
,
final_args
=
get_subcommand
(
args
)
self
.
assertTrue
(
issubclass
(
real_cmd
,
ListCommand
))
self
.
assertEqual
(
final_args
,
[
u
(
"
\
u263b
"
)])
def
test_default_cmd01
(
self
):
args
=
[
"bar"
]
real_cmd
,
final_args
=
get_subcommand
(
args
)
...
...
test/data/aliases.conf
View file @
33f314da
...
...
@@ -2,3 +2,4 @@
foo
=
rm
-
f
test
baz
=
FooBar
format
=
ls
-
F
"|I| x c d {(}p{)} s k"
-
n
25
smile
=
ls
☻
topydo/lib/Config.py
View file @
33f314da
...
...
@@ -17,9 +17,13 @@
import
os
import
shlex
from
six
import
iteritems
from
six
import
iteritems
,
PY2
from
six.moves
import
configparser
if
PY2
:
import
ushlex
as
shlex
import
codecs
class
ConfigError
(
Exception
):
def
__init__
(
self
,
p_text
):
self
.
text
=
p_text
...
...
@@ -132,6 +136,14 @@ class _Config:
if
p_path
is
not
None
:
files
=
[
p_path
]
if
PY2
:
for
path
in
files
:
try
:
with
codecs
.
open
(
path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
self
.
cp
.
readfp
(
f
)
except
IOError
:
pass
else
:
self
.
cp
.
read
(
files
)
self
.
_supplement_sections
()
...
...
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