Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
osp
tools.ethertoff
Commits
3adc60ca
Commit
3adc60ca
authored
Sep 10, 2014
by
eric
Browse files
The index command reads the ‘Site’ model to find out the current domain
parent
df6b6be7
Changes
1
Hide whitespace changes
Inline
Side-by-side
relearn/management/commands/index.py
View file @
3adc60ca
...
...
@@ -21,6 +21,7 @@ from django.template.loader import render_to_string
# Django Apps import
from
django.contrib.sites.models
import
Site
from
etherpadlite.models
import
Pad
,
PadAuthor
from
relearn.settings
import
BACKUP_DIR
...
...
@@ -93,6 +94,11 @@ short_names = {
"http://purl.org/dc/terms/identifier"
:
"id"
,
}
HOST
=
None
if
Site
.
objects
.
count
()
>
0
:
site
=
Site
.
objects
.
all
()[
0
]
HOST
=
site
.
domain
def
query_results_to_template_articles
(
query_results
):
"""
Transform the RDFLIB SPARQL query result into the row that we want to use for the template
...
...
@@ -151,11 +157,15 @@ def query_results_to_template_articles(query_results):
return
sorted
(
template_articles
,
key
=
lambda
a
:
a
[
'date'
]
if
'date'
in
a
else
0
,
reverse
=
True
)
def
snif
():
global
HOST
if
not
HOST
:
return
"No site domain settings found"
host
=
u
"http://%s/"
%
HOST
start
=
clock
()
g
=
rdflib
.
Graph
()
host
=
'http://f-u-t-u-r-e.org'
# host = 'http://127.0.0.1:8000'
host
=
HOST
i
=
0
total
=
Pad
.
objects
.
count
()
...
...
Write
Preview
Supports
Markdown
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