Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
b1d7ba24
Commit
b1d7ba24
authored
Jul 29, 2007
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Synced the old pt's with the new code in Five.
parent
0939a8e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
lib/python/Products/PageTemplates/PageTemplateFile.py
lib/python/Products/PageTemplates/PageTemplateFile.py
+9
-7
lib/python/Products/PageTemplates/ZopePageTemplate.py
lib/python/Products/PageTemplates/ZopePageTemplate.py
+9
-6
No files found.
lib/python/Products/PageTemplates/PageTemplateFile.py
View file @
b1d7ba24
...
@@ -17,7 +17,7 @@ from logging import getLogger
...
@@ -17,7 +17,7 @@ from logging import getLogger
import
AccessControl
import
AccessControl
from
Globals
import
package_home
,
InitializeClass
,
DevelopmentMode
from
Globals
import
package_home
,
InitializeClass
,
DevelopmentMode
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
from
Acquisition
import
aq_parent
,
aq_inner
from
Acquisition
import
aq_parent
,
aq_inner
,
aq_get
from
ComputedAttribute
import
ComputedAttribute
from
ComputedAttribute
import
ComputedAttribute
from
OFS.SimpleItem
import
SimpleItem
from
OFS.SimpleItem
import
SimpleItem
from
OFS.Traversable
import
Traversable
from
OFS.Traversable
import
Traversable
...
@@ -90,7 +90,10 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
...
@@ -90,7 +90,10 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
self
.
pt_edit
(
content
,
guess_type
(
filename
,
content
))
self
.
pt_edit
(
content
,
guess_type
(
filename
,
content
))
def
pt_getContext
(
self
):
def
pt_getContext
(
self
):
root
=
self
.
getPhysicalRoot
()
root
=
None
meth
=
aq_get
(
self
,
'getPhysicalRoot'
,
None
)
if
meth
is
not
None
:
root
=
meth
()
context
=
self
.
_getContext
()
context
=
self
.
_getContext
()
c
=
{
'template'
:
self
,
c
=
{
'template'
:
self
,
'here'
:
context
,
'here'
:
context
,
...
@@ -99,7 +102,7 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
...
@@ -99,7 +102,7 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
'nothing'
:
None
,
'nothing'
:
None
,
'options'
:
{},
'options'
:
{},
'root'
:
root
,
'root'
:
root
,
'request'
:
getattr
(
root
,
'REQUEST'
,
None
),
'request'
:
aq_get
(
root
,
'REQUEST'
,
None
),
'modules'
:
SecureModuleImporter
,
'modules'
:
SecureModuleImporter
,
}
}
return
c
return
c
...
@@ -111,12 +114,11 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
...
@@ -111,12 +114,11 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
kw
[
'args'
]
=
args
kw
[
'args'
]
=
args
bound_names
[
'options'
]
=
kw
bound_names
[
'options'
]
=
kw
try
:
request
=
aq_get
(
self
,
'REQUEST'
,
None
)
response
=
self
.
REQUEST
.
RESPONSE
if
request
is
not
None
:
response
=
request
.
response
if
not
response
.
headers
.
has_key
(
'content-type'
):
if
not
response
.
headers
.
has_key
(
'content-type'
):
response
.
setHeader
(
'content-type'
,
self
.
content_type
)
response
.
setHeader
(
'content-type'
,
self
.
content_type
)
except
AttributeError
:
pass
# Execute the template in a new security context.
# Execute the template in a new security context.
security
=
AccessControl
.
getSecurityManager
()
security
=
AccessControl
.
getSecurityManager
()
...
...
lib/python/Products/PageTemplates/ZopePageTemplate.py
View file @
b1d7ba24
...
@@ -17,6 +17,7 @@ $Id$
...
@@ -17,6 +17,7 @@ $Id$
import
re
import
re
import
os
import
os
import
Acquisition
import
Acquisition
from
Acquisition
import
aq_get
from
Globals
import
ImageFile
,
package_home
,
InitializeClass
from
Globals
import
ImageFile
,
package_home
,
InitializeClass
from
DateTime.DateTime
import
DateTime
from
DateTime.DateTime
import
DateTime
from
Shared.DC.Scripts.Script
import
Script
from
Shared.DC.Scripts.Script
import
Script
...
@@ -272,7 +273,10 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
...
@@ -272,7 +273,10 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
historyComparisonResults
=
html_diff
(
rev1
.
_text
,
rev2
.
_text
)
)
historyComparisonResults
=
html_diff
(
rev1
.
_text
,
rev2
.
_text
)
)
def
pt_getContext
(
self
,
*
args
,
**
kw
):
def
pt_getContext
(
self
,
*
args
,
**
kw
):
root
=
self
.
getPhysicalRoot
()
root
=
None
meth
=
aq_get
(
self
,
'getPhysicalRoot'
,
None
)
if
meth
is
not
None
:
root
=
meth
()
context
=
self
.
_getContext
()
context
=
self
.
_getContext
()
c
=
{
'template'
:
self
,
c
=
{
'template'
:
self
,
'here'
:
context
,
'here'
:
context
,
...
@@ -281,7 +285,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
...
@@ -281,7 +285,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
'nothing'
:
None
,
'nothing'
:
None
,
'options'
:
{},
'options'
:
{},
'root'
:
root
,
'root'
:
root
,
'request'
:
getattr
(
root
,
'REQUEST'
,
None
),
'request'
:
aq_get
(
root
,
'REQUEST'
,
None
),
'modules'
:
SecureModuleImporter
,
'modules'
:
SecureModuleImporter
,
}
}
return
c
return
c
...
@@ -303,12 +307,11 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
...
@@ -303,12 +307,11 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
kw
[
'args'
]
=
args
kw
[
'args'
]
=
args
bound_names
[
'options'
]
=
kw
bound_names
[
'options'
]
=
kw
try
:
request
=
aq_get
(
self
,
'REQUEST'
,
None
)
response
=
self
.
REQUEST
.
RESPONSE
if
request
is
not
None
:
response
=
request
.
response
if
not
response
.
headers
.
has_key
(
'content-type'
):
if
not
response
.
headers
.
has_key
(
'content-type'
):
response
.
setHeader
(
'content-type'
,
self
.
content_type
)
response
.
setHeader
(
'content-type'
,
self
.
content_type
)
except
AttributeError
:
pass
security
=
getSecurityManager
()
security
=
getSecurityManager
()
bound_names
[
'user'
]
=
security
.
getUser
()
bound_names
[
'user'
]
=
security
.
getUser
()
...
...
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