Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Fachgruppenwebseite Metadaten
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
fginfo
Fachgruppenwebseite Metadaten
Commits
4270bf98
Verified
Commit
4270bf98
authored
2 years ago
by
Jake
Browse files
Options
Downloads
Patches
Plain Diff
added prio to pages for sorting tags
parent
3e78fded
No related branches found
No related tags found
No related merge requests found
Pipeline
#318864
passed
2 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fgs/datatypes.py
+23
-3
23 additions, 3 deletions
fgs/datatypes.py
with
23 additions
and
3 deletions
fgs/datatypes.py
+
23
−
3
View file @
4270bf98
...
...
@@ -218,7 +218,14 @@ class Page:
return
res
def
__lt__
(
self
,
other
):
def
get_prio
(
self
):
if
'
prio
'
in
self
.
metadata
:
return
self
.
metadata
[
'
prio
'
]
else
:
return
0
prio
=
property
(
get_prio
,
None
,
None
)
def
__lt__
(
self
,
other
):
# for sorting by date modified (default)
if
not
self
.
initialized
:
raise
Exception
(
"
Page not initialized.
"
)
return
self
.
date_modified
<
other
.
date_modified
...
...
@@ -245,10 +252,11 @@ class Tag:
self
.
name
=
name
self
.
lang
=
lang
self
.
_config
=
None
self
.
pages
=
set
()
self
.
pages
_tuple
=
[]
self
.
is_category
=
False
self
.
_link
=
None
self
.
_factories
=
factories
self
.
_pages_cache
=
[]
def
get_config
(
self
):
...
...
@@ -291,11 +299,23 @@ class Tag:
return
if
page
.
lang
!=
self
.
lang
:
raise
Exception
(
"
Page has different lang than Tag.
"
,
page
.
lang
,
tag
.
lang
)
self
.
pages
.
add
(
page
)
if
page
not
in
self
.
pages
:
self
.
pages_tuple
.
append
((
page
.
prio
,
page
))
self
.
pages_tuple
.
sort
(
key
=
lambda
x
:
x
[
0
])
self
.
pages_tuple
.
reverse
()
if
is_category
:
self
.
is_category
=
is_category
def
get_pages
(
self
):
if
len
(
self
.
_pages_cache
)
!=
len
(
self
.
pages_tuple
):
res
=
[]
for
prio
,
page
in
self
.
pages_tuple
:
res
.
append
(
page
)
self
.
_pages_cache
=
res
return
self
.
_pages_cache
pages
=
property
(
get_pages
,
None
,
None
)
class
Date
:
def
__init__
(
self
,
dt
,
config
):
if
isinstance
(
dt
,
str
):
...
...
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