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
6ff44a9e
Commit
6ff44a9e
authored
Nov 26, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate and generalize creation of standard objects.
parent
9b3a5622
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
95 deletions
+100
-95
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+35
-95
lib/python/OFS/standard/index_html.dtml
lib/python/OFS/standard/index_html.dtml
+1
-0
lib/python/OFS/standard/standard_error_message.dtml
lib/python/OFS/standard/standard_error_message.dtml
+47
-0
lib/python/OFS/standard/standard_html_footer.dtml
lib/python/OFS/standard/standard_html_footer.dtml
+2
-0
lib/python/OFS/standard/standard_html_header.dtml
lib/python/OFS/standard/standard_html_header.dtml
+3
-0
lib/python/OFS/standard/standard_template.pt
lib/python/OFS/standard/standard_template.pt
+12
-0
No files found.
lib/python/OFS/Application.py
View file @
6ff44a9e
...
...
@@ -84,8 +84,8 @@
##############################################################################
__doc__
=
'''Application support
$Id: Application.py,v 1.17
0 2001/11/26 15:52
:07 evan Exp $'''
__version__
=
'$Revision: 1.17
0
$'
[
11
:
-
2
]
$Id: Application.py,v 1.17
1 2001/11/26 16:07
:07 evan Exp $'''
__version__
=
'$Revision: 1.17
1
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
os
,
sys
,
App
.
Product
,
App
.
ProductRegistry
,
misc_
import
time
,
traceback
,
os
,
string
,
Products
...
...
@@ -103,56 +103,7 @@ from misc_ import Misc_
import
ZDOM
from
zLOG
import
LOG
,
ERROR
,
WARNING
,
INFO
from
HelpSys.HelpSys
import
HelpSys
_standard_error_msg
=
'''
\
<dtml-var standard_html_header>
<dtml-if error_message>
<dtml-var error_message>
<dtml-else>
<H2>Site Error</H2>
<P>An error was encountered while publishing this resource.
</P>
<P>
<STRONG>Error Type: <dtml-var error_type html_quote></STRONG><BR>
<STRONG>Error Value: <dtml-var error_value html_quote></STRONG><BR>
</P>
<HR NOSHADE>
<P>Troubleshooting Suggestions</P>
<UL>
<dtml-if "error_type in ('KeyError','NameError')">
<LI>This resource may be trying to reference a
nonexistent object or variable <STRONG><dtml-var error_value></STRONG>.</LI>
</dtml-if>
<LI>The URL may be incorrect.</LI>
<LI>The parameters passed to this resource may be incorrect.</LI>
<LI>A resource that this resource relies on may be encountering
an error.</LI>
</UL>
<P>For more detailed information about the error, please
refer to the HTML source for this page.
</P>
<P>If the error persists please contact the site maintainer.
Thank you for your patience.
</P>
<dtml-comment>
Here, events like logging and other actions may also be performed, such as
sending mail automatically to the administrator.
</dtml-comment>
</dtml-if>
<dtml-var standard_html_footer>'''
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
class
Application
(
Globals
.
ApplicationDefaultPermissions
,
ZDOM
.
Root
,
Folder
.
Folder
,
...
...
@@ -171,12 +122,8 @@ class Application(Globals.ApplicationDefaultPermissions,
p_
=
misc_
.
p_
misc_
=
misc_
.
misc_
_reserved_names
=
(
'standard_html_header'
,
'standard_html_footer'
,
'standard_error_message'
,
'Control_Panel'
,
_reserved_names
=
(
'Control_Panel'
,
'browser_id_manager'
,
'session_data_manager'
,
'temp_folder'
)
# This class-default __allow_groups__ ensures that the
...
...
@@ -200,26 +147,6 @@ class Application(Globals.ApplicationDefaultPermissions,
cpl
.
_init
()
self
.
_setObject
(
'Control_Panel'
,
cpl
)
# Note that this may happen before products are
# installed, so we have to use addDocument as stand-alone.
import
Document
Document
.
manage_addDocument
(
self
,
'standard_html_header'
,
'Standard Html Header'
,
(
'<html><head><title>&dtml-title_or_id;'
'</title></head><body bgcolor="#FFFFFF">'
)
)
Document
.
manage_addDocument
(
self
,
'standard_html_footer'
,
'Standard Html Footer'
,
'</body></html>'
)
Document
.
manage_addDocument
(
self
,
'standard_error_message'
,
'Standard Error Message'
,
_standard_error_msg
)
def
id
(
self
):
try
:
return
self
.
REQUEST
[
'SCRIPT_NAME'
][
1
:]
except
:
return
self
.
title
...
...
@@ -366,8 +293,6 @@ class Application(Globals.ApplicationDefaultPermissions,
return
1
return
0
class
Expired
(
Globals
.
Persistent
):
icon
=
'p_/broken'
...
...
@@ -411,18 +336,7 @@ def initialize(app):
get_transaction
().
note
(
'Added Control_Panel.Products'
)
get_transaction
().
commit
()
# b/c: Ensure that std err msg exists.
if
not
hasattr
(
app
,
'standard_error_message'
):
import
Document
Document
.
manage_addDocument
(
app
,
'standard_error_message'
,
'Standard Error Message'
,
_standard_error_msg
)
get_transaction
().
note
(
'Added standard_error_message'
)
get_transaction
().
commit
()
# b/c: Ensure that a temp folder exists
# Ensure that a temp folder exists
if
not
hasattr
(
app
,
'temp_folder'
):
from
Products.TemporaryFolder.TemporaryFolder
import
\
MountedTemporaryFolder
...
...
@@ -432,7 +346,7 @@ def initialize(app):
get_transaction
().
commit
()
del
tf
#
b/c:
Ensure that there is a transient container in the temp folder
# Ensure that there is a transient container in the temp folder
tf
=
app
.
temp_folder
if
not
hasattr
(
tf
,
'session_data'
):
env_has
=
os
.
environ
.
get
...
...
@@ -502,7 +416,7 @@ def initialize(app):
del
tf
#
b/c:
Ensure that a browser ID manager exists
# Ensure that a browser ID manager exists
if
not
hasattr
(
app
,
'browser_id_manager'
):
from
Products.Sessions.BrowserIdManager
import
BrowserIdManager
bid
=
BrowserIdManager
(
'browser_id_manager'
,
'Browser Id Manager'
)
...
...
@@ -511,7 +425,7 @@ def initialize(app):
get_transaction
().
commit
()
del
bid
#
b/c:
Ensure that a session data manager exists
# Ensure that a session data manager exists
if
not
hasattr
(
app
,
'session_data_manager'
):
from
Products.Sessions.SessionDataManager
import
SessionDataManager
sdm
=
SessionDataManager
(
'session_data_manager'
,
...
...
@@ -523,7 +437,7 @@ def initialize(app):
get_transaction
().
commit
()
del
sdm
#
b/c:
Ensure that there's an Examples folder with examples.
# Ensure that there's an Examples folder with examples.
# However, make sure that if the examples have been added already
# and then deleted that we don't add them again.
if
not
hasattr
(
app
,
'Examples'
)
and
not
\
...
...
@@ -568,6 +482,7 @@ def initialize(app):
get_transaction
().
commit
()
install_products
(
app
)
install_standards
(
app
)
# Note that the code from here on only runs if we are not a ZEO
# client, or if we are a ZEO client and we've specified by way
...
...
@@ -852,6 +767,31 @@ def install_product(app, product_dir, product_name, meta_types,
if
raise_exc
:
raise
def
install_standards
(
app
):
# Install the replaceable standard objects
std_dir
=
os
.
path
.
join
(
Globals
.
package_home
(
globals
()),
'standard'
)
wrote
=
0
for
fn
in
os
.
listdir
(
std_dir
):
base
,
ext
=
os
.
path
.
splitext
(
fn
)
if
ext
==
'.dtml'
:
ob
=
Globals
.
DTMLFile
(
base
,
std_dir
)
fn
=
base
if
hasattr
(
app
,
fn
):
continue
app
.
manage_addProduct
[
'OFSP'
].
manage_addDTMLMethod
(
id
=
fn
,
file
=
open
(
ob
.
raw
))
elif
ext
in
(
'.pt'
,
'.zpt'
):
ob
=
PageTemplateFile
(
fn
,
std_dir
,
__name__
=
fn
)
if
hasattr
(
app
,
fn
):
continue
app
.
manage_addProduct
[
'PageTemplates'
].
manage_addPageTemplate
(
id
=
fn
,
title
=
''
,
text
=
open
(
ob
.
filename
))
wrote
=
1
ob
.
__replaceable__
=
Globals
.
REPLACEABLE
setattr
(
Application
,
fn
,
ob
)
if
wrote
:
get_transaction
().
note
(
'Installed standard objects'
)
get_transaction
().
commit
()
def
reinstall_product
(
app
,
product_name
):
folder_permissions
=
get_folder_permissions
()
...
...
lib/python/OFS/standard/index_html.dtml
0 → 100644
View file @
6ff44a9e
<dtml-var zope_quick_start>
lib/python/OFS/standard/standard_error_message.dtml
0 → 100644
View file @
6ff44a9e
<dtml-var standard_html_header>
<dtml-if error_message>
<dtml-var error_message>
<dtml-else>
<h2>Site Error</h2>
<p>An error was encountered while publishing this resource.
</p>
<p>
<strong>Error Type: &dtml-error_type;</strong><br />
<strong>Error Value: &dtml-error_value;</strong><br />
</P>
<hr noshade="noshade" />
<p>Troubleshooting Suggestions</p>
<ul>
<dtml-if "error_type in ('KeyError','NameError')">
<li>This resource may be trying to reference a
nonexistent object or variable <strong>&dtml-error_value;</strong>.</li>
</dtml-if>
<li>The URL may be incorrect.</li>
<li>The parameters passed to this resource may be incorrect.</li>
<li>A resource that this resource relies on may be encountering
an error.</li>
</ul>
<p>For more detailed information about the error, please
refer to the HTML source for this page.
</p>
<p>If the error persists please contact the site maintainer.
Thank you for your patience.
</p>
<dtml-comment>
Here, events like logging and other actions may also be performed, such as
sending mail automatically to the administrator.
</dtml-comment>
</dtml-if>
<dtml-var standard_html_footer>
lib/python/OFS/standard/standard_html_footer.dtml
0 → 100644
View file @
6ff44a9e
</body>
</html>
lib/python/OFS/standard/standard_html_header.dtml
0 → 100644
View file @
6ff44a9e
<html>
<head><title>
&dtml-title_or_id;
</title></head>
<body
bgcolor=
"#FFFFFF"
>
\ No newline at end of file
lib/python/OFS/standard/standard_template.pt
0 → 100644
View file @
6ff44a9e
<html
metal:define-macro=
"page"
>
<head>
<metal:block
define-slot=
"head"
>
<title
tal:content=
"template/title"
>
The Title
</title>
</metal:block>
</head>
<body>
<div
metal:define-slot=
"body"
>
This is where the page's body text goes.
</div>
</body>
</html>
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