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
86ee782b
Commit
86ee782b
authored
Nov 27, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When an identifier starts with zeroes, treat it as a regexp.
parent
380c1112
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
test/DoCommandTest.py
test/DoCommandTest.py
+8
-0
topydo/lib/TodoListBase.py
topydo/lib/TodoListBase.py
+7
-0
No files found.
test/DoCommandTest.py
View file @
86ee782b
...
@@ -157,6 +157,14 @@ class DoCommandTest(CommandTest.CommandTest):
...
@@ -157,6 +157,14 @@ class DoCommandTest(CommandTest.CommandTest):
self
.
assertFalse
(
self
.
output
)
self
.
assertFalse
(
self
.
output
)
self
.
assertEquals
(
self
.
errors
,
"Invalid todo number given.
\
n
"
)
self
.
assertEquals
(
self
.
errors
,
"Invalid todo number given.
\
n
"
)
def
test_invalid3
(
self
):
command
=
DoCommand
([
"01"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
output
)
self
.
assertEquals
(
self
.
errors
,
"Invalid todo number given.
\
n
"
)
def
test_activated_todos1
(
self
):
def
test_activated_todos1
(
self
):
command
=
DoCommand
([
"2"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
=
DoCommand
([
"2"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute
()
...
...
topydo/lib/TodoListBase.py
View file @
86ee782b
...
@@ -56,6 +56,13 @@ class TodoListBase(object):
...
@@ -56,6 +56,13 @@ class TodoListBase(object):
"""
"""
result
=
None
result
=
None
try
:
try
:
try
:
if
not
re
.
match
(
'[1-9]
\
d*
'
, p_identifier):
raise ValueError # leading zeros, pass to regexp
except TypeError:
# we'
re
dealing
with
an
integer
pass
result
=
self
.
_todos
[
int
(
p_identifier
)
-
1
]
result
=
self
.
_todos
[
int
(
p_identifier
)
-
1
]
except
IndexError
:
except
IndexError
:
raise
InvalidTodoException
raise
InvalidTodoException
...
...
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