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
f9cea257
Commit
f9cea257
authored
Mar 07, 2011
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- use getConfiguration() instead of Globals
parent
df9937c4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
47 deletions
+45
-47
src/App/ImageFile.py
src/App/ImageFile.py
+2
-4
src/App/special_dtml.py
src/App/special_dtml.py
+10
-5
src/HelpSys/HelpTopic.py
src/HelpSys/HelpTopic.py
+4
-3
src/Products/PageTemplates/PageTemplateFile.py
src/Products/PageTemplates/PageTemplateFile.py
+5
-8
src/ZPublisher/xmlrpc.py
src/ZPublisher/xmlrpc.py
+3
-5
src/Zope2/App/startup.py
src/Zope2/App/startup.py
+17
-17
src/Zope2/App/zcml.py
src/Zope2/App/zcml.py
+4
-5
No files found.
src/App/ImageFile.py
View file @
f9cea257
...
...
@@ -7,12 +7,11 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
##############################################################################
"""Image object that is stored in a file"""
import
os
import
os.path
import
stat
import
time
...
...
@@ -47,7 +46,6 @@ class ImageFile(Explicit):
security
=
ClassSecurityInfo
()
def
__init__
(
self
,
path
,
_prefix
=
None
):
import
Globals
# for data
if
_prefix
is
None
:
_prefix
=
getattr
(
getConfiguration
(),
'softwarehome'
,
None
)
or
PREFIX
if
not
os
.
path
.
isabs
(
path
):
...
...
@@ -57,7 +55,7 @@ class ImageFile(Explicit):
# _prefix is ignored if path is absolute
path
=
os
.
path
.
join
(
_prefix
,
path
)
self
.
path
=
path
if
Globals
.
DevelopmentM
ode
:
if
getConfiguration
().
debug_m
ode
:
# In development mode, a shorter time is handy
max_age
=
60
# One minute
else
:
...
...
src/App/special_dtml.py
View file @
f9cea257
...
...
@@ -7,15 +7,20 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
##############################################################################
import
DocumentTemplate
,
Common
,
Persistence
,
MethodObject
,
Globals
,
os
,
sy
s
from
types
import
InstanceType
import
o
s
import
sys
from
logging
import
getLogger
from
App.config
import
getConfiguration
from
types
import
InstanceType
import
DocumentTemplate
import
MethodObject
import
Persistence
from
App
import
Common
from
App.config
import
getConfiguration
LOG
=
getLogger
(
'special_dtml'
)
...
...
@@ -49,7 +54,7 @@ class ClassicHTMLFile(DocumentTemplate.HTMLFile,MethodObject.Method,):
apply
(
ClassicHTMLFile
.
inheritedAttribute
(
'__init__'
),
args
,
kw
)
def
_cook_check
(
self
):
if
Globals
.
DevelopmentM
ode
:
if
getConfiguration
().
debug_m
ode
:
__traceback_info__
=
self
.
raw
try
:
mtime
=
os
.
stat
(
self
.
raw
)[
8
]
except
:
mtime
=
0
...
...
src/HelpSys/HelpTopic.py
View file @
f9cea257
...
...
@@ -7,7 +7,7 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
##############################################################################
import
os
...
...
@@ -17,6 +17,7 @@ from AccessControl.Permissions import access_contents_information
from
AccessControl.Permissions
import
view
as
View
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
Acquisition
import
Implicit
from
App.config
import
getConfiguration
from
App.ImageFile
import
ImageFile
from
App.special_dtml
import
DTMLFile
from
App.special_dtml
import
HTML
...
...
@@ -26,6 +27,7 @@ from OFS.PropertyManager import PropertyManager
from
OFS.SimpleItem
import
Item
from
Persistence
import
Persistent
class
HelpTopicBase
:
"Mix-in Help Topic support class"
...
...
@@ -133,8 +135,7 @@ class HelpTopic(Implicit, HelpTopicBase, Item, PropertyManager, Persistent):
self
.
_v_last_read
=
mtime
def
_check_for_update
(
self
):
import
Globals
if
Globals
.
DevelopmentMode
:
if
getConfiguration
().
debug_mode
:
try
:
mtime
=
os
.
stat
(
self
.
file
)[
8
]
except
:
mtime
=
0
if
mtime
!=
self
.
_v_last_read
:
...
...
src/Products/PageTemplates/PageTemplateFile.py
View file @
f9cea257
...
...
@@ -7,7 +7,7 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
##############################################################################
...
...
@@ -17,18 +17,16 @@ from logging import getLogger
from
AccessControl.class_init
import
InitializeClass
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityManagement
import
getSecurityManager
from
Acquisition
import
aq_parent
,
aq_inner
,
aq_get
from
App.Common
import
package_home
from
App.special_dtml
import
DTMLFile
from
App.config
import
getConfiguration
from
Acquisition
import
aq_parent
,
aq_inner
,
aq_get
from
ComputedAttribute
import
ComputedAttribute
from
OFS.SimpleItem
import
SimpleItem
from
OFS.Traversable
import
Traversable
from
Shared.DC.Scripts.Script
import
Script
from
Shared.DC.Scripts.Signature
import
FuncCode
from
Products.PageTemplates.Expressions
import
SecureModuleImporter
from
Products.PageTemplates.PageTemplate
import
PageTemplate
from
Shared.DC.Scripts.Script
import
Script
from
Shared.DC.Scripts.Signature
import
FuncCode
from
zope.contenttype
import
guess_content_type
from
zope.pagetemplate.pagetemplatefile
import
sniff_type
...
...
@@ -140,8 +138,7 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
return
self
.
__name__
# Don't reveal filesystem paths
def
_cook_check
(
self
):
import
Globals
# for data
if
self
.
_v_last_read
and
not
Globals
.
DevelopmentMode
:
if
self
.
_v_last_read
and
not
getConfiguration
().
debug_mode
:
return
__traceback_info__
=
self
.
filename
try
:
...
...
src/ZPublisher/xmlrpc.py
View file @
f9cea257
...
...
@@ -7,7 +7,7 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
##############################################################################
"""XML-RPC support module
...
...
@@ -24,11 +24,10 @@ import sys
import
types
import
xmlrpclib
from
App.config
import
getConfiguration
from
zExceptions
import
Unauthorized
from
ZODB.POSException
import
ConflictError
from
ZPublisher.HTTPResponse
import
HTTPResponse
# Make DateTime.DateTime marshallable via XML-RPC
# http://www.zope.org/Collectors/Zope/2109
from
DateTime.DateTime
import
DateTime
...
...
@@ -168,8 +167,7 @@ class Response:
remove
=
[
r"<[^<>]*>"
,
r"&[A-Za-z]+;"
]
for
pat
in
remove
:
vstr
=
re
.
sub
(
pat
,
" "
,
vstr
)
import
Globals
# for data
if
Globals
.
DevelopmentMode
:
if
getConfiguration
().
debug_mode
:
from
traceback
import
format_exception
value
=
'
\
n
'
+
''
.
join
(
format_exception
(
t
,
vstr
,
tb
))
else
:
...
...
src/Zope2/App/startup.py
View file @
f9cea257
...
...
@@ -13,11 +13,19 @@
"""Initialize the Zope2 Package and provide a published module
"""
from
zope.component
import
queryMultiAdapter
from
zope.event
import
notify
from
zope.processlifetime
import
DatabaseOpened
from
zope.processlifetime
import
DatabaseOpenedWithRoot
import
imp
import
logging
import
sys
from
time
import
asctime
import
AccessControl.User
import
App.ZApplication
import
ExtensionClass
import
OFS.Application
import
transaction
import
ZODB
import
Zope2
import
ZPublisher
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
noSecurityManager
from
Acquisition
import
aq_acquire
...
...
@@ -26,21 +34,13 @@ from Acquisition import aq_inner
from
Acquisition
import
aq_parent
from
Acquisition.interfaces
import
IAcquirer
from
App.config
import
getConfiguration
from
time
import
asctime
from
zExceptions
import
Redirect
from
zExceptions
import
Unauthorized
from
ZODB.POSException
import
ConflictError
import
transaction
import
AccessControl.User
import
ExtensionClass
import
imp
import
logging
import
OFS.Application
import
sys
import
ZODB
import
App.ZApplication
import
Zope2
import
ZPublisher
from
zope.component
import
queryMultiAdapter
from
zope.event
import
notify
from
zope.processlifetime
import
DatabaseOpened
from
zope.processlifetime
import
DatabaseOpenedWithRoot
app
=
None
startup_time
=
asctime
()
...
...
@@ -127,7 +127,7 @@ def startup():
# Initialize the app object
application
=
app
()
OFS
.
Application
.
initialize
(
application
)
if
Globals
.
DevelopmentM
ode
:
if
getConfiguration
().
debug_m
ode
:
# Set up auto-refresh.
from
App.RefreshFuncs
import
setupAutoRefresh
setupAutoRefresh
(
application
.
_p_jar
)
...
...
src/Zope2/App/zcml.py
View file @
f9cea257
...
...
@@ -14,8 +14,9 @@
"""ZCML machinery
"""
import
os
import
os.path
from
App.config
import
getConfiguration
from
zope.configuration
import
xmlconfig
_initialized
=
False
...
...
@@ -30,11 +31,9 @@ def load_site(force=False):
return
_initialized
=
True
import
Globals
Globals
.
INSTANCE_HOME
# load instance site configuration file
site_zcml
=
os
.
path
.
join
(
Globals
.
INSTANCE_HOME
,
"etc"
,
"site.zcml"
)
instancehome
=
getConfiguration
().
instancehome
site_zcml
=
os
.
path
.
join
(
instancehome
,
"etc"
,
"site.zcml"
)
if
not
os
.
path
.
exists
(
site_zcml
):
# check for zope installation home skel during running unit tests
...
...
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