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
9d90c59f
Commit
9d90c59f
authored
Dec 12, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let date_string_to_date raise ValueError instead of returning None.
parent
d9efdf83
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
12 deletions
+19
-12
topydo/lib/DoCommand.py
topydo/lib/DoCommand.py
+4
-1
topydo/lib/Filter.py
topydo/lib/Filter.py
+0
-2
topydo/lib/Todo.py
topydo/lib/Todo.py
+8
-1
topydo/lib/Utils.py
topydo/lib/Utils.py
+7
-8
No files found.
topydo/lib/DoCommand.py
View file @
9d90c59f
...
...
@@ -41,7 +41,10 @@ class DoCommand(DCommand):
if
p_opt
==
"-s"
or
p_opt
==
"--strict"
:
self
.
strict_recurrence
=
True
elif
p_opt
==
"-d"
or
p_opt
==
"--date"
:
self
.
completion_date
=
date_string_to_date
(
p_value
)
or
date
.
today
()
try
:
self
.
completion_date
=
date_string_to_date
(
p_value
)
except
ValueError
:
self
.
completion_date
=
date
.
today
()
def
_handle_recurrence
(
self
):
if
self
.
todo
.
has_tag
(
'rec'
):
...
...
topydo/lib/Filter.py
View file @
9d90c59f
...
...
@@ -175,8 +175,6 @@ class OrdinalTagFilter(Filter):
if not operand2:
operand2 = date_string_to_date(self.value)
if not operand1 or not operand2:
raise ValueError
except ValueError:
try:
operand1 = int(p_todo.tag_value(self.key))
...
...
topydo/lib/Todo.py
View file @
9d90c59f
...
...
@@ -37,7 +37,14 @@ class Todo(TodoBase):
def
get_date
(
self
,
p_tag
):
""" Given a date tag, return a date object. """
string
=
self
.
tag_value
(
p_tag
)
return
date_string_to_date
(
string
)
if
string
else
None
result
=
None
try
:
result
=
date_string_to_date
(
string
)
if
string
else
None
except
ValueError
:
pass
return
result
def
start_date
(
self
):
""" Returns a date object of the todo's start date. """
...
...
topydo/lib/Utils.py
View file @
9d90c59f
...
...
@@ -31,14 +31,13 @@ def date_string_to_date(p_date):
if
p_date
:
parsed_date
=
re
.
match
(
r'(\
d{
4})-(\
d{
2})-(\
d{
2})'
,
p_date
)
if
parsed_date
:
try
:
result
=
date
(
int
(
parsed_date
.
group
(
1
)),
# year
int
(
parsed_date
.
group
(
2
)),
# month
int
(
parsed_date
.
group
(
3
))
# day
)
except
ValueError
:
result
=
None
result
=
date
(
int
(
parsed_date
.
group
(
1
)),
# year
int
(
parsed_date
.
group
(
2
)),
# month
int
(
parsed_date
.
group
(
3
))
# day
)
else
:
raise
ValueError
return
result
...
...
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