Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
79817d51
Commit
79817d51
authored
Jan 27, 2011
by
Carl Whittaker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed missing context attribute.
parent
0a655dc6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
15 deletions
+4
-15
pystache/view.py
+4
-15
No files found.
pystache/view.py
View file @
79817d51
...
@@ -29,10 +29,10 @@ class View(object):
...
@@ -29,10 +29,10 @@ class View(object):
def
__init__
(
self
,
template
=
None
,
context
=
None
,
**
kwargs
):
def
__init__
(
self
,
template
=
None
,
context
=
None
,
**
kwargs
):
self
.
template
=
template
self
.
template
=
template
context
=
context
or
{}
self
.
context
=
context
or
{}
context
.
update
(
**
kwargs
)
self
.
context
.
update
(
**
kwargs
)
self
.
context_list
=
[
context
]
self
.
context_list
=
[
self
.
context
]
def
get
(
self
,
attr
,
default
=
None
):
def
get
(
self
,
attr
,
default
=
None
):
attr
=
get_or_attr
(
self
.
context_list
,
attr
,
getattr
(
self
,
attr
,
default
))
attr
=
get_or_attr
(
self
.
context_list
,
attr
,
getattr
(
self
,
attr
,
default
))
...
@@ -77,15 +77,5 @@ class View(object):
...
@@ -77,15 +77,5 @@ class View(object):
raise
KeyError
(
"No such key '
%
s'."
%
attr
)
raise
KeyError
(
"No such key '
%
s'."
%
attr
)
return
val
return
val
def
__getattr__
(
self
,
attr
):
if
attr
==
'context'
:
context
=
{}
for
d
in
self
.
context_list
:
context
.
update
(
d
)
return
context
raise
AttributeError
(
"No such attribute '
%
s'."
%
attr
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
render
()
return
self
.
render
()
\ No newline at end of file
Write
Preview
Markdown
is supported
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