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
077213b0
Commit
077213b0
authored
Jan 08, 2006
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zLOG -> logging
parent
3e92bb2d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
54 deletions
+48
-54
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+34
-43
lib/python/OFS/Cache.py
lib/python/OFS/Cache.py
+9
-7
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+2
-2
lib/python/OFS/subscribers.py
lib/python/OFS/subscribers.py
+3
-2
No files found.
lib/python/OFS/Application.py
View file @
077213b0
...
@@ -16,6 +16,7 @@ $Id$
...
@@ -16,6 +16,7 @@ $Id$
"""
"""
import
os
,
sys
,
traceback
import
os
,
sys
,
traceback
from
logging
import
getLogger
from
cgi
import
escape
from
cgi
import
escape
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
warnings
import
warn
from
warnings
import
warn
...
@@ -34,7 +35,7 @@ from DateTime import DateTime
...
@@ -34,7 +35,7 @@ from DateTime import DateTime
from
HelpSys.HelpSys
import
HelpSys
from
HelpSys.HelpSys
import
HelpSys
from
webdav.NullResource
import
NullResource
from
webdav.NullResource
import
NullResource
from
zExceptions
import
Redirect
as
RedirectException
,
Forbidden
from
zExceptions
import
Redirect
as
RedirectException
,
Forbidden
from
zLOG
import
LOG
,
ERROR
,
WARNING
,
INFO
from
zope.interface
import
implements
from
zope.interface
import
implements
import
Folder
import
Folder
...
@@ -44,6 +45,7 @@ from FindSupport import FindSupport
...
@@ -44,6 +45,7 @@ from FindSupport import FindSupport
from
interfaces
import
IApplication
from
interfaces
import
IApplication
from
misc_
import
Misc_
from
misc_
import
Misc_
LOG
=
getLogger
(
'Application'
)
class
Application
(
Globals
.
ApplicationDefaultPermissions
,
class
Application
(
Globals
.
ApplicationDefaultPermissions
,
ZDOM
.
Root
,
Folder
.
Folder
,
ZDOM
.
Root
,
Folder
.
Folder
,
...
@@ -234,9 +236,7 @@ class Application(Globals.ApplicationDefaultPermissions,
...
@@ -234,9 +236,7 @@ class Application(Globals.ApplicationDefaultPermissions,
ob
.
_register
()
ob
.
_register
()
result
=
1
result
=
1
if
not
rebuild
:
if
not
rebuild
:
LOG
(
'Zope'
,
INFO
,
LOG
.
info
(
'Registered ZClass: %s'
%
ob
.
id
)
'Registered ZClass: %s'
%
ob
.
id
)
# Include subobjects.
# Include subobjects.
if
hasattr
(
base
,
'objectItems'
):
if
hasattr
(
base
,
'objectItems'
):
m
=
list
(
ob
.
objectItems
())
m
=
list
(
ob
.
objectItems
())
...
@@ -249,9 +249,8 @@ class Application(Globals.ApplicationDefaultPermissions,
...
@@ -249,9 +249,8 @@ class Application(Globals.ApplicationDefaultPermissions,
m
=
list
(
ps
.
methods
.
objectItems
())
m
=
list
(
ps
.
methods
.
objectItems
())
items
.
extend
(
m
)
items
.
extend
(
m
)
except
:
except
:
LOG
(
'Zope'
,
WARNING
,
LOG
.
warn
(
'Broken objects exist in product %s.'
%
product
.
id
,
'Broken objects exist in product %s.'
%
product
.
id
,
exc_info
=
sys
.
exc_info
())
error
=
sys
.
exc_info
())
return
result
return
result
...
@@ -263,11 +262,11 @@ class Application(Globals.ApplicationDefaultPermissions,
...
@@ -263,11 +262,11 @@ class Application(Globals.ApplicationDefaultPermissions,
try
:
try
:
keys
=
list
(
self
.
_p_jar
.
root
()[
'ZGlobals'
].
keys
())
keys
=
list
(
self
.
_p_jar
.
root
()[
'ZGlobals'
].
keys
())
except
:
except
:
LOG
(
'Zope'
,
ERROR
,
LOG
.
error
(
'A problem was found when checking the global product '
\
'A problem was found when checking the global product '
\
'registry. This is probably due to a Product being '
\
'registry. This is probably due to a Product being '
\
'uninstalled or renamed. The traceback follows.'
,
'uninstalled or renamed. The traceback follows.'
,
e
rror
=
sys
.
exc_info
())
e
xc_info
=
sys
.
exc_info
())
return
1
return
1
return
0
return
0
...
@@ -384,10 +383,9 @@ class AppInitializer:
...
@@ -384,10 +383,9 @@ class AppInitializer:
mount_paths
=
[
x
[
0
]
for
x
in
dbtab_config
.
listMountPaths
()
]
mount_paths
=
[
x
[
0
]
for
x
in
dbtab_config
.
listMountPaths
()
]
if
not
'/temp_folder'
in
mount_paths
:
if
not
'/temp_folder'
in
mount_paths
:
# we won't be able to create the mount point properly
# we won't be able to create the mount point properly
LOG
(
'Zope Default Object Creation'
,
ERROR
,
LOG
.
error
(
'Could not initialze a Temporary Folder because '
(
'Could not initialze a Temporary Folder because '
'a database was not configured to be mounted at '
'a database was not configured to be mounted at '
'the /temp_folder mount point'
)
)
'the /temp_folder mount point'
)
return
return
try
:
try
:
manage_addMounts
(
app
,
(
'/temp_folder'
,))
manage_addMounts
(
app
,
(
'/temp_folder'
,))
...
@@ -395,10 +393,8 @@ class AppInitializer:
...
@@ -395,10 +393,8 @@ class AppInitializer:
self
.
commit
(
'Added temp_folder'
)
self
.
commit
(
'Added temp_folder'
)
tf
=
app
.
temp_folder
tf
=
app
.
temp_folder
except
:
except
:
LOG
(
'Zope Default Object Creation'
,
ERROR
,
LOG
.
error
(
'Could not add a /temp_folder mount point due to an '
(
'Could not add a /temp_folder mount point due to an '
'error.'
,
exc_info
=
sys
.
exc_info
())
'error.'
),
error
=
sys
.
exc_info
())
return
return
# Ensure that there is a transient object container in the temp folder
# Ensure that there is a transient object container in the temp folder
...
@@ -421,15 +417,13 @@ class AppInitializer:
...
@@ -421,15 +417,13 @@ class AppInitializer:
default_period_secs
)
default_period_secs
)
if
addnotify
and
app
.
unrestrictedTraverse
(
addnotify
,
None
)
is
None
:
if
addnotify
and
app
.
unrestrictedTraverse
(
addnotify
,
None
)
is
None
:
LOG
(
'Zope Default Object Creation'
,
WARNING
,
LOG
.
warn
(
'failed to use nonexistent "%s" script as '
(
'failed to use nonexistent "%s" script as '
'session-add-notify-script-path'
%
addnotify
)
'session-add-notify-script-path'
%
addnotify
))
addnotify
=
None
addnotify
=
None
if
delnotify
and
app
.
unrestrictedTraverse
(
delnotify
,
None
)
is
None
:
if
delnotify
and
app
.
unrestrictedTraverse
(
delnotify
,
None
)
is
None
:
LOG
(
'Zope Default Object Creation'
,
WARNING
,
LOG
.
warn
(
'failed to use nonexistent "%s" script as '
(
'failed to use nonexistent "%s" script as '
'session-delete-notify-script-path'
%
delnotify
)
'session-delete-notify-script-path'
%
delnotify
))
delnotify
=
None
delnotify
=
None
toc
=
TransientObjectContainer
(
toc
=
TransientObjectContainer
(
...
@@ -572,17 +566,17 @@ class AppInitializer:
...
@@ -572,17 +566,17 @@ class AppInitializer:
bad_things
=
0
bad_things
=
0
try
:
try
:
if
app
.
checkGlobalRegistry
():
if
app
.
checkGlobalRegistry
():
LOG
(
'Zope'
,
INFO
,
LOG
.
info
(
'Beginning attempt to rebuild the global ZClass registry.'
)
'Beginning attempt to rebuild the global ZClass registry.'
)
app
.
fixupZClassDependencies
(
rebuild
=
1
)
app
.
fixupZClassDependencies
(
rebuild
=
1
)
did_fixups
=
1
did_fixups
=
1
LOG
(
'Zope'
,
INFO
,
LOG
.
info
(
'The global ZClass registry has successfully been rebuilt.'
)
'The global ZClass registry has successfully been rebuilt.'
)
transaction
.
get
().
note
(
'Rebuilt global product registry'
)
transaction
.
get
().
note
(
'Rebuilt global product registry'
)
transaction
.
commit
()
transaction
.
commit
()
except
:
except
:
bad_things
=
1
bad_things
=
1
LOG
(
'Zope'
,
ERROR
,
'The attempt to rebuild the registry failed.'
,
LOG
.
error
(
'The attempt to rebuild the registry failed.'
,
error
=
sys
.
exc_info
())
error
=
sys
.
exc_info
())
transaction
.
abort
()
transaction
.
abort
()
...
@@ -599,18 +593,15 @@ class AppInitializer:
...
@@ -599,18 +593,15 @@ class AppInitializer:
# product was added or updated and we are not a ZEO client.
# product was added or updated and we are not a ZEO client.
if
getattr
(
Globals
,
'__disk_product_installed__'
,
None
):
if
getattr
(
Globals
,
'__disk_product_installed__'
,
None
):
try
:
try
:
LOG
(
'Zope'
,
INFO
,
LOG
.
info
(
'New disk product detected, determining if we need '
(
'New disk product detected, determining if we need '
'to fix up any ZClasses.'
)
'to fix up any ZClasses.'
))
if
app
.
fixupZClassDependencies
():
if
app
.
fixupZClassDependencies
():
LOG
(
'Zope'
,
INFO
,
LOG
.
info
(
'Repaired broken ZClass dependencies.'
)
'Repaired broken ZClass dependencies.'
)
self
.
commit
(
'Repaired broked ZClass dependencies'
)
self
.
commit
(
'Repaired broked ZClass dependencies'
)
except
:
except
:
LOG
(
'Zope'
,
ERROR
,
LOG
.
error
(
'Attempt to fixup ZClass dependencies after '
(
'Attempt to fixup ZClass dependencies after '
'detecting an updated disk-based product failed.'
,
'detecting an updated disk-based product failed.'
),
exc_info
=
sys
.
exc_info
())
error
=
sys
.
exc_info
())
transaction
.
abort
()
transaction
.
abort
()
def
install_products
(
self
):
def
install_products
(
self
):
...
@@ -687,7 +678,7 @@ def import_products():
...
@@ -687,7 +678,7 @@ def import_products():
for
priority
,
product_name
,
index
,
product_dir
in
products
:
for
priority
,
product_name
,
index
,
product_dir
in
products
:
if
done
.
has_key
(
product_name
):
if
done
.
has_key
(
product_name
):
LOG
(
'OFS.Application'
,
WARNING
,
'Duplicate Product name'
,
LOG
.
warn
(
'Duplicate Product name'
,
'After loading Product %s from %s,
\
n
'
'After loading Product %s from %s,
\
n
'
'I skipped the one in %s.
\
n
'
%
(
'I skipped the one in %s.
\
n
'
%
(
`product_name`
,
`done[product_name]`
,
`product_dir`
)
)
`product_name`
,
`done[product_name]`
,
`product_dir`
)
)
...
@@ -725,8 +716,8 @@ def import_product(product_dir, product_name, raise_exc=0, log_exc=1):
...
@@ -725,8 +716,8 @@ def import_product(product_dir, product_name, raise_exc=0, log_exc=1):
except
:
except
:
exc
=
sys
.
exc_info
()
exc
=
sys
.
exc_info
()
if
log_exc
:
if
log_exc
:
LOG
(
'Zope'
,
ERROR
,
'Could not import %s'
%
pname
,
LOG
.
error
(
'Could not import %s'
%
pname
,
error
=
exc
)
exc_info
=
exc
)
f
=
StringIO
()
f
=
StringIO
()
traceback
.
print_exc
(
100
,
f
)
traceback
.
print_exc
(
100
,
f
)
f
=
f
.
getvalue
()
f
=
f
.
getvalue
()
...
@@ -869,8 +860,8 @@ def install_product(app, product_dir, product_name, meta_types,
...
@@ -869,8 +860,8 @@ def install_product(app, product_dir, product_name, meta_types,
except
:
except
:
if
log_exc
:
if
log_exc
:
LOG
(
'Zope'
,
ERROR
,
'Couldn
\
'
t install %s'
%
product_name
,
LOG
.
error
(
'Couldn
\
'
t install %s'
%
product_name
,
error
=
sys
.
exc_info
())
exc_info
=
sys
.
exc_info
())
transaction
.
abort
()
transaction
.
abort
()
if
raise_exc
:
if
raise_exc
:
raise
raise
...
...
lib/python/OFS/Cache.py
View file @
077213b0
...
@@ -15,11 +15,12 @@
...
@@ -15,11 +15,12 @@
$Id$
$Id$
"""
"""
import
time
,
sys
import
time
,
sys
from
logging
import
getLogger
import
Globals
import
Globals
from
Globals
import
InitializeClass
from
Globals
import
InitializeClass
from
Globals
import
DTMLFile
from
Globals
import
DTMLFile
from
Acquisition
import
aq_get
,
aq_acquire
,
aq_inner
,
aq_parent
,
aq_base
from
Acquisition
import
aq_get
,
aq_acquire
,
aq_inner
,
aq_parent
,
aq_base
from
zLOG
import
LOG
,
WARNING
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
from
AccessControl.Role
import
_isBeingUsedAsAMethod
from
AccessControl.Role
import
_isBeingUsedAsAMethod
...
@@ -30,6 +31,7 @@ ZCM_MANAGERS = '__ZCacheManager_ids__'
...
@@ -30,6 +31,7 @@ ZCM_MANAGERS = '__ZCacheManager_ids__'
ViewManagementScreensPermission
=
view_management_screens
ViewManagementScreensPermission
=
view_management_screens
ChangeCacheSettingsPermission
=
'Change cache settings'
ChangeCacheSettingsPermission
=
'Change cache settings'
LOG
=
getLogger
(
'Cache'
)
def
isCacheable
(
ob
):
def
isCacheable
(
ob
):
...
@@ -186,8 +188,8 @@ class Cacheable:
...
@@ -186,8 +188,8 @@ class Cacheable:
mtime_func
,
default
)
mtime_func
,
default
)
return
val
return
val
except
:
except
:
LOG
(
'Cache'
,
WARNING
,
'ZCache_get() exception'
,
LOG
.
warn
(
'ZCache_get() exception'
,
e
rror
=
sys
.
exc_info
())
e
xc_info
=
sys
.
exc_info
())
return
default
return
default
return
default
return
default
...
@@ -204,8 +206,8 @@ class Cacheable:
...
@@ -204,8 +206,8 @@ class Cacheable:
c
.
ZCache_set
(
ob
,
data
,
view_name
,
keywords
,
c
.
ZCache_set
(
ob
,
data
,
view_name
,
keywords
,
mtime_func
)
mtime_func
)
except
:
except
:
LOG
(
'Cache'
,
WARNING
,
'ZCache_set() exception'
,
LOG
.
warn
(
'ZCache_set() exception'
,
e
rror
=
sys
.
exc_info
())
e
xc_info
=
sys
.
exc_info
())
security
.
declareProtected
(
ViewManagementScreensPermission
,
security
.
declareProtected
(
ViewManagementScreensPermission
,
'ZCacheable_invalidate'
)
'ZCacheable_invalidate'
)
...
@@ -224,8 +226,8 @@ class Cacheable:
...
@@ -224,8 +226,8 @@ class Cacheable:
except
:
except
:
exc
=
sys
.
exc_info
()
exc
=
sys
.
exc_info
()
try
:
try
:
LOG
(
'Cache'
,
WARNING
,
'ZCache_invalidate() exception'
,
LOG
.
warn
(
'ZCache_invalidate() exception'
,
e
rror
=
exc
)
e
xc_info
=
exc
)
message
=
'An exception occurred: %s: %s'
%
exc
[:
2
]
message
=
'An exception occurred: %s: %s'
%
exc
[:
2
]
finally
:
finally
:
exc
=
None
exc
=
None
...
...
lib/python/OFS/ObjectManager.py
View file @
077213b0
...
@@ -685,8 +685,8 @@ class ObjectManager(
...
@@ -685,8 +685,8 @@ class ObjectManager(
try
:
try
:
stat
=
marshal
.
loads
(
v
.
manage_FTPstat
(
REQUEST
))
stat
=
marshal
.
loads
(
v
.
manage_FTPstat
(
REQUEST
))
except
:
except
:
LOG
(
"FTP"
,
ERROR
,
"Failed to stat file '%s'"
%
k
,
LOG
.
error
(
"Failed to stat file '%s'"
%
k
,
error
=
sys
.
exc_info
())
exc_info
=
sys
.
exc_info
())
stat
=
None
stat
=
None
if
stat
is
not
None
:
if
stat
is
not
None
:
out
=
out
+
((
k
,
stat
),)
out
=
out
+
((
k
,
stat
),)
...
...
lib/python/OFS/subscribers.py
View file @
077213b0
...
@@ -19,8 +19,8 @@ $Id$
...
@@ -19,8 +19,8 @@ $Id$
import
warnings
import
warnings
import
sys
import
sys
from
logging
import
getLogger
from
zLOG
import
LOG
,
ERROR
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
...
@@ -35,6 +35,7 @@ from zope.app.location.interfaces import ISublocations
...
@@ -35,6 +35,7 @@ from zope.app.location.interfaces import ISublocations
deprecatedManageAddDeleteClasses
=
[]
deprecatedManageAddDeleteClasses
=
[]
LOG
=
getLogger
(
'OFS.subscribers'
)
def
compatibilityCall
(
method_name
,
*
args
):
def
compatibilityCall
(
method_name
,
*
args
):
"""Call a method if events have not been setup yet.
"""Call a method if events have not been setup yet.
...
@@ -152,7 +153,7 @@ def callManageBeforeDelete(ob, item, container):
...
@@ -152,7 +153,7 @@ def callManageBeforeDelete(ob, item, container):
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
:
LOG
(
'Zope'
,
ERROR
,
'_delObject() threw'
,
error
=
sys
.
exc_info
())
LOG
.
error
(
'_delObject() threw'
,
exc_info
=
sys
.
exc_info
())
# In debug mode when non-Manager, let exceptions propagate.
# In debug mode when non-Manager, let exceptions propagate.
if
getConfiguration
().
debug_mode
:
if
getConfiguration
().
debug_mode
:
if
not
getSecurityManager
().
getUser
().
has_role
(
'Manager'
):
if
not
getSecurityManager
().
getUser
().
has_role
(
'Manager'
):
...
...
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