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
738b1a04
Commit
738b1a04
authored
Oct 09, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add convenience function to check priority validity.
parent
6638beb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
PriorityCommand.py
PriorityCommand.py
+2
-4
TodoBase.py
TodoBase.py
+2
-1
Utils.py
Utils.py
+2
-0
No files found.
PriorityCommand.py
View file @
738b1a04
import
re
import
Command
from
Utils
import
convert_todo_number
from
Utils
import
convert_todo_number
,
is_valid_priority
class
PriorityCommand
(
Command
.
Command
):
def
__init__
(
self
,
p_args
,
p_todolist
):
...
...
@@ -11,7 +9,7 @@ class PriorityCommand(Command.Command):
self
.
priority
=
self
.
argument
(
1
)
def
execute
(
self
):
if
re
.
match
(
'^[A-Z]$'
,
self
.
priority
):
if
is_valid_priority
(
self
.
priority
):
old_priority
=
self
.
todo
.
priority
()
self
.
todolist
.
set_priority
(
self
.
number
,
self
.
priority
)
...
...
TodoBase.py
View file @
738b1a04
...
...
@@ -6,6 +6,7 @@ from datetime import date
import
re
import
TodoParser
from
Utils
import
is_valid_priority
class
TodoBase
(
object
):
"""
...
...
@@ -116,7 +117,7 @@ class TodoBase(object):
"""
if not self.is_completed() and
\
(p_priority == None or
re.match('
^
[
A
-
Z
]
$
',
p_priority)):
(p_priority == None or
is_valid_priority(
p_priority)):
self.fields['
priority
'] = p_priority
...
...
Utils.py
View file @
738b1a04
...
...
@@ -35,3 +35,5 @@ def convert_todo_number(p_number):
return
p_number
def
is_valid_priority
(
p_priority
):
return
re
.
match
(
r'^[A-Z]$'
,
p_priority
)
!=
None
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