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
7d7ddeb4
Commit
7d7ddeb4
authored
May 12, 2010
by
Paul Bonser
Committed by
Chris Wanstrath
May 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update View class to return context items via subscript as well
parent
2baff1a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
pystache/view.py
+9
-6
No files found.
pystache/view.py
View file @
7d7ddeb4
...
@@ -44,12 +44,6 @@ class View(object):
...
@@ -44,12 +44,6 @@ class View(object):
if
view
.
template_name
:
if
view
.
template_name
:
self
.
template_name
=
view
.
template_name
self
.
template_name
=
view
.
template_name
def
__contains__
(
self
,
needle
):
return
hasattr
(
self
,
needle
)
def
__getitem__
(
self
,
attr
):
return
getattr
(
self
,
attr
)()
def
load_template
(
self
):
def
load_template
(
self
):
if
self
.
template
:
if
self
.
template
:
return
self
.
template
return
self
.
template
...
@@ -97,6 +91,15 @@ class View(object):
...
@@ -97,6 +91,15 @@ class View(object):
return
re
.
sub
(
'[A-Z]'
,
repl
,
name
)[
1
:]
return
re
.
sub
(
'[A-Z]'
,
repl
,
name
)[
1
:]
def
__contains__
(
self
,
needle
):
return
needle
in
self
.
context
or
hasattr
(
self
,
needle
)
def
__getitem__
(
self
,
attr
):
val
=
self
.
get
(
attr
,
None
)
if
not
val
:
raise
KeyError
(
"No such key."
)
return
val
def
get
(
self
,
attr
,
default
):
def
get
(
self
,
attr
,
default
):
attr
=
self
.
context
.
get
(
attr
,
getattr
(
self
,
attr
,
default
))
attr
=
self
.
context
.
get
(
attr
,
getattr
(
self
,
attr
,
default
))
...
...
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