Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sjrpc
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
sjrpc
Commits
66fa0f98
Commit
66fa0f98
authored
14 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
better tagdisplay type patter matching. Better match is selected
parent
4269ef4c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cccli/tagdisplay.py
+11
-2
11 additions, 2 deletions
cccli/tagdisplay.py
with
11 additions
and
2 deletions
cccli/tagdisplay.py
+
11
−
2
View file @
66fa0f98
...
@@ -58,14 +58,23 @@ class TagDisplay(object):
...
@@ -58,14 +58,23 @@ class TagDisplay(object):
'''
Transform a tagvalue respecting custom display settings
'''
'''
Transform a tagvalue respecting custom display settings
'''
tagname
=
unicode
(
tagname
)
tagname
=
unicode
(
tagname
)
tagvalue
=
unicode
(
tagvalue
)
tagvalue
=
unicode
(
tagvalue
)
# check general options
if
bool
(
self
.
option
.
get
(
"
quotespace
"
,
False
)):
if
bool
(
self
.
option
.
get
(
"
quotespace
"
,
False
)):
if
re
.
search
(
"
\s
"
,
tagvalue
)
is
not
None
:
if
re
.
search
(
"
\s
"
,
tagvalue
)
is
not
None
:
tagvalue
=
"'
%s
'"
%
re
.
sub
(
"'"
,
"
\'
"
,
tagvalue
)
tagvalue
=
"'
%s
'"
%
re
.
sub
(
"'"
,
"
\'
"
,
tagvalue
)
# build list of matching pattern with tagname
l
=
[
x
for
x
in
self
.
tagtype
if
fnmatch
.
fnmatch
(
tagname
,
x
)
]
l
=
[
x
for
x
in
self
.
tagtype
if
fnmatch
.
fnmatch
(
tagname
,
x
)
]
if
len
(
l
)
>
0
and
self
.
tagtype
[
l
[
0
]]
in
self
.
types
:
if
len
(
l
)
>
0
:
return
getattr
(
self
,
"
type_%s
"
%
self
.
tagtype
[
l
[
0
]])(
tagvalue
)
# select longest match
tm
=
max
(
l
)
if
self
.
tagtype
[
tm
]
in
self
.
types
:
return
getattr
(
self
,
"
type_%s
"
%
self
.
tagtype
[
tm
])(
tagvalue
)
return
tagvalue
return
tagvalue
def
type_string
(
self
,
value
):
'''
DO Nothing
'''
return
value
()
def
type_lower
(
self
,
value
):
def
type_lower
(
self
,
value
):
'''
Lower case type
'''
'''
Lower case type
'''
return
value
.
lower
()
return
value
.
lower
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment