Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-mako
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-mako
Commits
94bd8111
Commit
94bd8111
authored
18 years ago
by
Mike Bayer
Browse files
Options
Downloads
Patches
Plain Diff
trying to make autohandler extension look better. theyre going to want a tag....
parent
afe036c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/mako/codegen.py
+1
-1
1 addition, 1 deletion
lib/mako/codegen.py
lib/mako/ext/autohandler.py
+6
-3
6 additions, 3 deletions
lib/mako/ext/autohandler.py
lib/mako/runtime.py
+2
-2
2 additions, 2 deletions
lib/mako/runtime.py
with
9 additions
and
6 deletions
lib/mako/codegen.py
+
1
−
1
View file @
94bd8111
...
@@ -134,7 +134,7 @@ class _GenerateRenderMethod(object):
...
@@ -134,7 +134,7 @@ class _GenerateRenderMethod(object):
self
.
printer
.
write_indented_block
(
n
.
text
)
self
.
printer
.
write_indented_block
(
n
.
text
)
def
write_inherit
(
self
,
node
):
def
write_inherit
(
self
,
node
):
self
.
printer
.
writeline
(
"
def _mako_inherit(context):
"
)
self
.
printer
.
writeline
(
"
def _mako_inherit(
template,
context):
"
)
self
.
printer
.
writeline
(
"
_mako_generate_namespaces(context)
"
)
self
.
printer
.
writeline
(
"
_mako_generate_namespaces(context)
"
)
self
.
printer
.
writeline
(
"
return runtime.inherit_from(context, %s, _template_filename)
"
%
(
node
.
parsed_attributes
[
'
file
'
]))
self
.
printer
.
writeline
(
"
return runtime.inherit_from(context, %s, _template_filename)
"
%
(
node
.
parsed_attributes
[
'
file
'
]))
self
.
printer
.
writeline
(
None
)
self
.
printer
.
writeline
(
None
)
...
...
This diff is collapsed.
Click to expand it.
lib/mako/ext/autohandler.py
+
6
−
3
View file @
94bd8111
"""
adds autohandler functionality to Mako templates
"""
"""
adds autohandler functionality to Mako templates.
requires that the TemplateLookup class is used with templates.
"""
import
posixpath
,
os
,
re
import
posixpath
,
os
,
re
def
autohandler
(
context
,
_template_filename
,
name
=
'
autohandler
'
):
def
autohandler
(
template
,
context
,
name
=
'
autohandler
'
):
lookup
=
context
.
lookup
lookup
=
context
.
lookup
_template_filename
=
template
.
module
.
_template_filename
if
not
lookup
.
filesystem_checks
:
if
not
lookup
.
filesystem_checks
:
try
:
try
:
return
lookup
.
_uri_cache
[(
autohandler
,
_template_filename
,
name
)]
return
lookup
.
_uri_cache
[(
autohandler
,
_template_filename
,
name
)]
...
...
This diff is collapsed.
Click to expand it.
lib/mako/runtime.py
+
2
−
2
View file @
94bd8111
...
@@ -175,7 +175,7 @@ def inherit_from(context, uri, calling_filename):
...
@@ -175,7 +175,7 @@ def inherit_from(context, uri, calling_filename):
context
.
_data
[
'
parent
'
]
=
lclcontext
.
_data
[
'
local
'
]
=
ih
.
inherits
context
.
_data
[
'
parent
'
]
=
lclcontext
.
_data
[
'
local
'
]
=
ih
.
inherits
callable_
=
getattr
(
template
.
module
,
'
_mako_inherit
'
,
None
)
callable_
=
getattr
(
template
.
module
,
'
_mako_inherit
'
,
None
)
if
callable_
is
not
None
:
if
callable_
is
not
None
:
ret
=
callable_
(
lclcontext
)
ret
=
callable_
(
template
,
lclcontext
)
if
ret
:
if
ret
:
return
ret
return
ret
...
@@ -197,7 +197,7 @@ def _populate_self_namespace(context, template, self_ns=None):
...
@@ -197,7 +197,7 @@ def _populate_self_namespace(context, template, self_ns=None):
self_ns
=
Namespace
(
'
self:%s
'
%
template
.
description
,
context
,
template
=
template
,
populate_self
=
False
)
self_ns
=
Namespace
(
'
self:%s
'
%
template
.
description
,
context
,
template
=
template
,
populate_self
=
False
)
context
.
_data
[
'
self
'
]
=
context
.
_data
[
'
local
'
]
=
self_ns
context
.
_data
[
'
self
'
]
=
context
.
_data
[
'
local
'
]
=
self_ns
if
hasattr
(
template
.
module
,
'
_mako_inherit
'
):
if
hasattr
(
template
.
module
,
'
_mako_inherit
'
):
ret
=
template
.
module
.
_mako_inherit
(
context
)
ret
=
template
.
module
.
_mako_inherit
(
template
,
context
)
if
ret
:
if
ret
:
return
ret
return
ret
return
(
template
.
callable_
,
context
)
return
(
template
.
callable_
,
context
)
...
...
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