Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mutalyzer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
Mirrors
mutalyzer
Commits
d109030c
Commit
d109030c
authored
11 years ago
by
Vermaat
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused TAL related code
parent
c4bd4f39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mutalyzer/website.py
+9
-116
9 additions, 116 deletions
mutalyzer/website.py
with
9 additions
and
116 deletions
mutalyzer/website.py
+
9
−
116
View file @
d109030c
...
@@ -77,117 +77,6 @@ urls = (
...
@@ -77,117 +77,6 @@ urls = (
)
)
class
render_tal
:
"""
Render interface to TAL templates.
Example to render /templates/hello.html with parameter
'
alice
'
:
>>>
render
=
render_tal
(
'
templates
'
)
>>>
render
.
hello
(
'
alice
'
)
"""
def
__init__
(
self
,
path
,
globals
=
{}):
"""
@arg path: Path to templates directory.
@kwarg globals: Dictionary of global template variables.
"""
self
.
path
=
path
self
.
globals
=
globals
#__init__
def
__getattr__
(
self
,
name
):
"""
Returns a template. Call the template to get a render.
@arg name: Template name (usually a HTML filename without
'
.html
'
).
@return: Template render function.
"""
filename
=
name
def
template
(
args
=
{},
scheme
=
'
html
'
,
standalone
=
False
,
prevent_caching
=
False
,
page
=
None
):
"""
Template render function.
If a scheme of
'
html
'
is choosen, the template name is assumed
to be a filename without its
'
.html
'
suffix. Otherwise it is
assumed to be a full filename.
The render of the template is wrapped in the HTML site layout
with menu if scheme is
'
html
'
and standalone is False.
@arg args: Arguments for template.
@kwarg scheme: One of
'
html
'
,
'
file
'
.
@kwarg standalone: Includes HTML site layout and sets interactive
argument for template.
@return: Render of template.
"""
page
=
page
or
filename
file
=
filename
if
scheme
==
'
html
'
:
file
+=
'
.html
'
path
=
os
.
path
.
join
(
self
.
path
,
file
)
context
=
simpleTALES
.
Context
()
context
.
addGlobal
(
'
interactive
'
,
not
standalone
)
for
name
,
value
in
self
.
globals
.
items
():
context
.
addGlobal
(
name
,
value
)
for
name
,
value
in
args
.
items
():
context
.
addGlobal
(
name
,
value
)
templateFile
=
open
(
path
,
'
r
'
)
template
=
simpleTAL
.
compileHTMLTemplate
(
templateFile
)
templateFile
.
close
()
# Wrap in site layout with menu
if
scheme
==
'
html
'
and
not
standalone
:
context
.
addGlobal
(
'
sitemacros
'
,
template
)
# The following three lines are a hack to get class="active"
# on the active menu item, working around TAL.
active
=
defaultdict
(
lambda
:
'
menu
'
)
active
[
page
]
=
'
menu active
'
context
.
addGlobal
(
'
active
'
,
active
)
templateFile
=
open
(
os
.
path
.
join
(
self
.
path
,
'
menu.html
'
),
'
r
'
)
template
=
simpleTAL
.
compileHTMLTemplate
(
templateFile
)
templateFile
.
close
()
if
scheme
==
'
html
'
:
web
.
header
(
'
Content-Type
'
,
'
text/html
'
)
if
prevent_caching
:
web
.
header
(
'
Cache-Control
'
,
'
no-cache
'
)
web
.
header
(
'
Expires
'
,
'
-1
'
)
io
=
StringIO
()
template
.
expand
(
context
,
io
)
return
io
.
getvalue
()
#template
return
template
#__getattr__
#render_tal
# TAL template render
render_
=
render_tal
(
pkg_resources
.
resource_filename
(
'
mutalyzer
'
,
'
templates
'
),
globals
=
{
'
version
'
:
mutalyzer
.
__version__
,
'
nomenclatureVersion
'
:
mutalyzer
.
NOMENCLATURE_VERSION
,
'
releaseDate
'
:
mutalyzer
.
__date__
,
'
release
'
:
mutalyzer
.
RELEASE
,
'
copyrightYears
'
:
mutalyzer
.
COPYRIGHT_YEARS
,
'
contactEmail
'
:
config
.
get
(
'
email
'
),
'
serviceSoapLocation
'
:
SERVICE_SOAP_LOCATION
,
'
serviceJsonLocation
'
:
SERVICE_JSON_LOCATION
,
'
piwik
'
:
config
.
get
(
'
piwik
'
),
'
piwikBase
'
:
config
.
get
(
'
piwikBase
'
),
'
piwikSite
'
:
config
.
get
(
'
piwikSite
'
)
})
# Jinja2 template render
# Jinja2 template render
# Todo: We rely on Apache to add a Content-Type header, we should actually
# Todo: We rely on Apache to add a Content-Type header, we should actually
# set it ourselves.
# set it ourselves.
...
@@ -591,6 +480,7 @@ class PositionConverter:
...
@@ -591,6 +480,7 @@ class PositionConverter:
# We have to put up with this crap just to get a certain <option>
# We have to put up with this crap just to get a certain <option>
# selected in our TAL template.
# selected in our TAL template.
# Todo: Now we switched to Jinja2, we can make this sane.
if
build
in
avail_builds
:
if
build
in
avail_builds
:
selected_build
=
build
selected_build
=
build
else
:
else
:
...
@@ -1166,6 +1056,7 @@ class BatchChecker:
...
@@ -1166,6 +1056,7 @@ class BatchChecker:
# We have to put up with this crap just to get a certain <option>
# We have to put up with this crap just to get a certain <option>
# selected in our TAL template.
# selected in our TAL template.
# Todo: Now we switched to Jinja2, we can make this sane.
if
arg1
in
avail_builds
:
if
arg1
in
avail_builds
:
selected_build
=
arg1
selected_build
=
arg1
else
:
else
:
...
@@ -1330,6 +1221,7 @@ class Uploader:
...
@@ -1330,6 +1221,7 @@ class Uploader:
# We have to put up with this crap just to get a certain <option>
# We have to put up with this crap just to get a certain <option>
# selected in our TAL template.
# selected in our TAL template.
# Todo: Now we switched to Jinja2, we can make this sane.
selected_assembly
=
config
.
get
(
'
defaultDb
'
)
selected_assembly
=
config
.
get
(
'
defaultDb
'
)
unselected_assemblies
=
sorted
(
b
for
b
in
available_assemblies
unselected_assemblies
=
sorted
(
b
for
b
in
available_assemblies
if
b
!=
selected_assembly
)
if
b
!=
selected_assembly
)
...
@@ -1408,6 +1300,7 @@ class Uploader:
...
@@ -1408,6 +1300,7 @@ class Uploader:
# We have to put up with this crap just to get a certain <option>
# We have to put up with this crap just to get a certain <option>
# selected in our TAL template.
# selected in our TAL template.
# Todo: Now we switched to Jinja2, we can make this sane.
if
i
.
chrnameassembly
in
available_assemblies
:
if
i
.
chrnameassembly
in
available_assemblies
:
selected_assembly
=
i
.
chrnameassembly
selected_assembly
=
i
.
chrnameassembly
else
:
else
:
...
@@ -1563,15 +1456,15 @@ class SoapApi:
...
@@ -1563,15 +1456,15 @@ class SoapApi:
class
Static
:
class
Static
:
"""
"""
Static page, just render a
TAL
template on GET.
Static page, just render a
Jinja2
template on GET.
"""
"""
def
GET
(
self
,
page
=
None
):
def
GET
(
self
,
page
=
None
):
"""
"""
Render a
TAL
template as HTML.
Render a
Jinja2
template as HTML.
@kwarg page: Page name to render
_
. A
TAL
template with this name
must
@kwarg page: Page name to render. A
Jinja2
template with this name
exist. Special case is a page of None, having the
same
must
exist. Special case is a page of None, having the
effect as
'
index
'
.
same
effect as
'
index
'
.
@type page: string
@type page: string
Be careful to only call this method with an argument that is a simple
Be careful to only call this method with an argument that is a simple
...
...
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