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
c8e4cd5c
Commit
c8e4cd5c
authored
Aug 14, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify control panel objects and actually make them non-persistent.
parent
006ee05c
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
292 additions
and
1174 deletions
+292
-1174
src/App/ApplicationManager.py
src/App/ApplicationManager.py
+76
-116
src/App/CacheManager.py
src/App/CacheManager.py
+0
-257
src/App/dtml/activity.dtml
src/App/dtml/activity.dtml
+0
-82
src/App/dtml/cacheGC.dtml
src/App/dtml/cacheGC.dtml
+0
-59
src/App/dtml/cacheParameters.dtml
src/App/dtml/cacheParameters.dtml
+0
-115
src/App/dtml/cpContents.dtml
src/App/dtml/cpContents.dtml
+1
-18
src/App/dtml/dbMain.dtml
src/App/dtml/dbMain.dtml
+96
-13
src/App/dtml/editFactory.dtml
src/App/dtml/editFactory.dtml
+0
-101
src/App/dtml/manage_style_test.dtml
src/App/dtml/manage_style_test.dtml
+0
-166
src/App/dtml/menu.dtml
src/App/dtml/menu.dtml
+13
-2
src/App/dtml/zope_quick_start.dtml
src/App/dtml/zope_quick_start.dtml
+0
-35
src/App/tests/test_ApplicationManager.py
src/App/tests/test_ApplicationManager.py
+102
-120
src/App/tests/test_cachemanager.py
src/App/tests/test_cachemanager.py
+0
-59
src/OFS/Application.py
src/OFS/Application.py
+3
-11
src/OFS/tests/testAppInitializer.py
src/OFS/tests/testAppInitializer.py
+0
-8
src/Zope2/App/startup.py
src/Zope2/App/startup.py
+1
-10
src/Zope2/Startup/datatypes.py
src/Zope2/Startup/datatypes.py
+0
-2
No files found.
src/App/ApplicationManager.py
View file @
c8e4cd5c
...
...
@@ -11,55 +11,22 @@
#
##############################################################################
from
logging
import
getLogger
import
os
import
sys
from
thread
import
get_ident
import
time
import
urllib
from
AccessControl.class_init
import
InitializeClass
from
AccessControl.requestmethod
import
requestmethod
from
Acquisition
import
Implicit
from
App.CacheManager
import
CacheManager
from
App.config
import
getConfiguration
from
App.Management
import
Tabs
from
App.special_dtml
import
DTMLFile
from
App.version_txt
import
version_txt
from
OFS.Folder
import
Folder
from
OFS.SimpleItem
import
Item
from
OFS.SimpleItem
import
SimpleItem
from
OFS.Traversable
import
Traversable
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
from
zExceptions
import
Redirect
LOG
=
getLogger
(
'ApplicationManager'
)
class
DatabaseManager
(
Item
,
Implicit
):
"""Database management (legacy)
"""
manage
=
manage_main
=
DTMLFile
(
'dtml/dbMain'
,
globals
())
manage_main
.
_setName
(
'manage_main'
)
id
=
'DatabaseManagement'
name
=
title
=
'Database Management'
meta_type
=
'Database Management'
manage_options
=
((
{
'label'
:
'Database'
,
'action'
:
'manage_main'
},
{
'label'
:
'Activity'
,
'action'
:
'manage_activity'
},
{
'label'
:
'Cache Parameters'
,
'action'
:
'manage_cacheParameters'
},
{
'label'
:
'Flush Cache'
,
'action'
:
'manage_cacheGC'
},
))
# These need to be here rather to make tabs work correctly. This
# needs to be revisited.
manage_activity
=
DTMLFile
(
'dtml/activity'
,
globals
())
manage_cacheParameters
=
DTMLFile
(
'dtml/cacheParameters'
,
globals
())
manage_cacheGC
=
DTMLFile
(
'dtml/cacheGC'
,
globals
())
InitializeClass
(
DatabaseManager
)
class
FakeConnection
:
class
FakeConnection
(
object
):
# Supports the methods of Connection that CacheManager needs
def
__init__
(
self
,
db
,
parent_jar
):
...
...
@@ -69,21 +36,22 @@ class FakeConnection:
return
self
.
_db
class
DatabaseChooser
(
SimpleItem
):
class
DatabaseChooser
(
Tabs
,
Traversable
,
Implicit
):
""" Choose which database to view
"""
meta_type
=
'Database Management'
__allow_access_to_unprotected_subobjects__
=
1
id
=
'Database'
name
=
title
=
'Database Management'
isPrincipiaFolderish
=
1
meta_type
=
'Database Management'
manage_main
=
PageTemplateFile
(
'www/chooseDatabase.pt'
,
globals
())
manage_options
=
(
{
'label'
:
'Control Panel'
,
'action'
:
'../manage_main'
},
{
'label'
:
'Databases'
,
'action'
:
'manage_main'
},
)
manage_main
=
PageTemplateFile
(
'www/chooseDatabase.pt'
,
globals
())
def
__init__
(
self
,
id
):
self
.
id
=
id
MANAGE_TABS_NO_BANNER
=
True
def
getDatabaseNames
(
self
,
quote
=
False
):
configuration
=
getConfiguration
()
...
...
@@ -107,56 +75,28 @@ class DatabaseChooser(SimpleItem):
return
self
[
name
]
return
getattr
(
self
,
name
)
def
tpValues
(
self
):
names
=
self
.
getDatabaseNames
()
res
=
[]
for
name
in
names
:
m
=
AltDatabaseManager
()
m
.
id
=
name
# Avoid opening the database just for the tree widget.
m
.
_p_jar
=
None
res
.
append
(
m
.
__of__
(
self
))
return
res
InitializeClass
(
DatabaseChooser
)
class
ApplicationManager
(
Folder
,
CacheManager
):
class
ApplicationManager
(
Tabs
,
Traversable
,
Implicit
):
"""System management
"""
__allow_access_to_unprotected_subobjects__
=
1
__roles__
=
(
'Manager'
,)
isPrincipiaFolderish
=
1
Database
=
DatabaseChooser
(
'Database'
)
# DatabaseManager()
manage
=
manage_main
=
DTMLFile
(
'dtml/cpContents'
,
globals
())
manage_main
.
_setName
(
'manage_main'
)
_objects
=
(
{
'id'
:
'Database'
,
'meta_type'
:
Database
.
meta_type
},
)
manage_options
=
({
'label'
:
'Control Panel'
,
'action'
:
'manage_main'
},
)
id
=
'Control_Panel'
name
=
title
=
'Control Panel'
meta_type
=
'Control Panel'
process_id
=
os
.
getpid
()
process_start
=
int
(
time
.
time
())
# Disable some inappropriate operations
manage_addObject
=
None
manage_delObjects
=
None
manage_addProperty
=
None
manage_editProperties
=
None
manage_delProperties
=
None
def
_canCopy
(
self
,
op
=
0
):
return
0
Database
=
DatabaseChooser
()
def
_init
(
self
):
pass
manage
=
manage_main
=
DTMLFile
(
'dtml/cpContents'
,
globals
())
manage_main
.
_setName
(
'manage_main'
)
manage_options
=
(
{
'label'
:
'Control Panel'
,
'action'
:
'manage_main'
},
{
'label'
:
'Databases'
,
'action'
:
'Database/manage_main'
},
)
MANAGE_TABS_NO_BANNER
=
True
def
version_txt
(
self
):
if
not
hasattr
(
self
,
'_v_version_txt'
):
...
...
@@ -164,27 +104,65 @@ class ApplicationManager(Folder, CacheManager):
return
self
.
_v_version_txt
def
process_id
(
self
):
return
os
.
getpid
()
def
sys_version
(
self
):
return
sys
.
version
def
sys_platform
(
self
):
return
sys
.
platform
def
manage_app
(
self
,
URL2
):
"""Return to the main management screen"""
raise
Redirect
(
URL2
+
'/manage'
)
def
thread_get_ident
(
self
):
return
get_ident
()
def
debug_mode
(
self
):
return
getConfiguration
().
debug_mode
def
getINSTANCE_HOME
(
self
):
return
getConfiguration
().
instancehome
def
getCLIENT_HOME
(
self
):
return
getConfiguration
().
clienthome
class
AltDatabaseManager
(
Tabs
,
Implicit
):
""" Database management DBTab-style
"""
id
=
'DatabaseManagement'
name
=
title
=
'Database Management'
meta_type
=
'Database Management'
manage
=
manage_main
=
DTMLFile
(
'dtml/dbMain'
,
globals
())
manage_main
.
_setName
(
'manage_main'
)
manage_options
=
((
{
'label'
:
'Control Panel'
,
'action'
:
'../../manage_main'
},
{
'label'
:
'Databases'
,
'action'
:
'../manage_main'
},
{
'label'
:
'Database'
,
'action'
:
'manage_main'
},
))
MANAGE_TABS_NO_BANNER
=
True
def
_getDB
(
self
):
return
self
.
_p_jar
.
db
()
def
cache_length
(
self
):
return
self
.
_getDB
().
cacheSize
()
def
cache_length_bytes
(
self
):
return
self
.
_getDB
().
getCacheSizeBytes
()
def
cache_detail_length
(
self
):
return
self
.
_getDB
().
cacheDetailSize
()
def
cache_size
(
self
):
db
=
self
.
_getDB
()
return
db
.
getCacheSize
()
def
database_size
(
self
):
return
self
.
_getDB
().
objectCount
()
def
db_name
(
self
):
return
self
.
_
p_jar
.
db
().
getName
()
return
self
.
_
getDB
().
getName
()
def
db_size
(
self
):
s
=
self
.
_
p_jar
.
db
().
getSize
()
s
=
self
.
_
getDB
().
getSize
()
if
isinstance
(
s
,
str
):
return
s
...
...
@@ -193,31 +171,13 @@ class ApplicationManager(Folder, CacheManager):
return
'%.1fK'
%
(
s
/
1024.0
)
@
requestmethod
(
'POST'
)
def
manage_pack
(
self
,
days
=
0
,
REQUEST
=
None
,
_when
=
None
):
"""Pack the database"""
if
_when
is
None
:
_when
=
time
.
time
()
t
=
_when
-
(
days
*
86400
)
def
manage_minimize
(
self
,
value
=
1
,
REQUEST
=
None
):
"Perform a full sweep through the cache"
# XXX Add a deprecation warning about value?
self
.
_getDB
().
cacheMinimize
()
db
=
self
.
_p_jar
.
db
()
t
=
db
.
pack
(
t
)
if
REQUEST
is
not
None
:
REQUEST
[
'RESPONSE'
].
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_workspace'
)
return
t
response
=
REQUEST
[
'RESPONSE'
]
response
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
def
getINSTANCE_HOME
(
self
):
return
getConfiguration
().
instancehome
def
getCLIENT_HOME
(
self
):
return
getConfiguration
().
clienthome
class
AltDatabaseManager
(
DatabaseManager
,
CacheManager
):
""" Database management DBTab-style
"""
db_name
=
ApplicationManager
.
db_name
.
im_func
db_size
=
ApplicationManager
.
db_size
.
im_func
manage_pack
=
ApplicationManager
.
manage_pack
.
im_func
InitializeClass
(
AltDatabaseManager
)
src/App/CacheManager.py
deleted
100644 → 0
View file @
006ee05c
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
#
##############################################################################
'''Cache management support.
This class is mixed into the database manager in App.ApplicationManager.
'''
from
AccessControl.class_init
import
InitializeClass
from
App.special_dtml
import
DTMLFile
from
DateTime.DateTime
import
DateTime
class
CacheManager
(
object
):
"""Cache management mix-in
"""
_cache_age
=
60
_vcache_age
=
60
_history_length
=
3600
# Seconds
manage_cacheParameters
=
DTMLFile
(
'dtml/cacheParameters'
,
globals
())
manage_cacheGC
=
DTMLFile
(
'dtml/cacheGC'
,
globals
())
def
_getDB
(
self
):
return
self
.
_p_jar
.
db
()
def
cache_length
(
self
):
return
self
.
_getDB
().
cacheSize
()
def
cache_length_bytes
(
self
):
return
self
.
_getDB
().
getCacheSizeBytes
()
def
cache_detail_length
(
self
):
return
self
.
_getDB
().
cacheDetailSize
()
def
database_size
(
self
):
return
self
.
_getDB
().
objectCount
()
def
cache_age
(
self
):
return
self
.
_cache_age
def
manage_cache_age
(
self
,
value
,
REQUEST
):
"set cache age"
db
=
self
.
_getDB
()
self
.
_cache_age
=
value
db
.
setCacheDeactivateAfter
(
value
)
if
REQUEST
is
not
None
:
response
=
REQUEST
[
'RESPONSE'
]
response
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_cacheParameters'
)
def
cache_size
(
self
):
db
=
self
.
_getDB
()
return
db
.
getCacheSize
()
def
manage_cache_size
(
self
,
value
,
REQUEST
):
"set cache size"
db
=
self
.
_getDB
()
db
.
setCacheSize
(
value
)
if
REQUEST
is
not
None
:
response
=
REQUEST
[
'RESPONSE'
]
response
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_cacheParameters'
)
def
manage_full_sweep
(
self
,
value
,
REQUEST
):
"Perform a full sweep through the cache"
db
=
self
.
_getDB
()
db
.
cacheFullSweep
(
value
)
if
REQUEST
is
not
None
:
response
=
REQUEST
[
'RESPONSE'
]
response
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_cacheGC'
)
def
manage_minimize
(
self
,
value
=
1
,
REQUEST
=
None
):
"Perform a full sweep through the cache"
# XXX Add a deprecation warning about value?
self
.
_getDB
().
cacheMinimize
()
if
REQUEST
is
not
None
:
response
=
REQUEST
[
'RESPONSE'
]
response
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_cacheGC'
)
def
cache_detail
(
self
,
REQUEST
=
None
):
"""
Returns the name of the classes of the objects in the cache
and the number of objects in the cache for each class.
"""
detail
=
self
.
_getDB
().
cacheDetail
()
if
REQUEST
is
not
None
:
# format as text
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
return
'
\
n
'
.
join
(
[
'%6d %s'
%
(
count
,
name
)
for
name
,
count
in
detail
])
# raw
return
detail
def
cache_extreme_detail
(
self
,
REQUEST
=
None
):
"""
Returns information about each object in the cache.
"""
detail
=
self
.
_getDB
().
cacheExtremeDetail
()
if
REQUEST
is
not
None
:
# sort the list.
lst
=
[((
dict
[
'conn_no'
],
dict
[
'oid'
]),
dict
)
for
dict
in
detail
]
# format as text.
res
=
[
'# Table shows connection number, oid, refcount, state, '
'and class.'
,
'# States: L = loaded, G = ghost, C = changed'
]
for
sortkey
,
dict
in
lst
:
id
=
dict
.
get
(
'id'
,
None
)
if
id
:
idinfo
=
' (%s)'
%
id
else
:
idinfo
=
''
s
=
dict
[
'state'
]
if
s
==
0
:
state
=
'L'
# loaded
elif
s
==
1
:
state
=
'C'
# changed
else
:
state
=
'G'
# ghost
res
.
append
(
'%d %-34s %6d %s %s%s'
%
(
dict
[
'conn_no'
],
repr
(
dict
[
'oid'
]),
dict
[
'rc'
],
state
,
dict
[
'klass'
],
idinfo
))
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
return
'
\
n
'
.
join
(
res
)
else
:
# raw
return
detail
def
_getActivityMonitor
(
self
):
db
=
self
.
_getDB
()
if
not
hasattr
(
db
,
'getActivityMonitor'
):
return
None
am
=
db
.
getActivityMonitor
()
if
am
is
None
:
return
None
return
am
def
getHistoryLength
(
self
):
am
=
self
.
_getActivityMonitor
()
if
am
is
None
:
return
0
return
am
.
getHistoryLength
()
def
manage_setHistoryLength
(
self
,
length
,
REQUEST
=
None
):
"""Change the length of the activity monitor history.
"""
am
=
self
.
_getActivityMonitor
()
length
=
int
(
length
)
if
length
<
0
:
raise
ValueError
(
'length can not be negative'
)
if
am
is
not
None
:
am
.
setHistoryLength
(
length
)
self
.
_history_length
=
length
# Restore on startup
if
REQUEST
is
not
None
:
response
=
REQUEST
[
'RESPONSE'
]
response
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_activity'
)
def
getActivityChartData
(
self
,
segment_height
,
REQUEST
=
None
):
"""Returns information for generating an activity chart.
"""
am
=
self
.
_getActivityMonitor
()
if
am
is
None
:
return
None
if
REQUEST
is
not
None
:
start
=
float
(
REQUEST
.
get
(
'chart_start'
,
0
))
end
=
float
(
REQUEST
.
get
(
'chart_end'
,
0
))
divisions
=
int
(
REQUEST
.
get
(
'chart_divisions'
,
10
))
analysis
=
am
.
getActivityAnalysis
(
start
,
end
,
divisions
)
else
:
analysis
=
am
.
getActivityAnalysis
()
total_load_count
=
0
total_store_count
=
0
total_connections
=
0
limit
=
0
divs
=
[]
for
div
in
analysis
:
total_store_count
=
total_store_count
+
div
[
'stores'
]
total_load_count
=
total_load_count
+
div
[
'loads'
]
total_connections
=
total_connections
+
div
[
'connections'
]
sum
=
div
[
'stores'
]
+
div
[
'loads'
]
if
sum
>
limit
:
limit
=
sum
if
analysis
:
segment_time
=
analysis
[
0
][
'end'
]
-
analysis
[
0
][
'start'
]
else
:
segment_time
=
0
for
div
in
analysis
:
stores
=
div
[
'stores'
]
if
stores
>
0
:
store_len
=
max
(
int
(
segment_height
*
stores
/
limit
),
1
)
else
:
store_len
=
0
loads
=
div
[
'loads'
]
if
loads
>
0
:
load_len
=
max
(
int
(
segment_height
*
loads
/
limit
),
1
)
else
:
load_len
=
0
t
=
div
[
'end'
]
-
analysis
[
-
1
][
'end'
]
# Show negative numbers.
if
segment_time
>=
3600
:
# Show hours.
time_offset
=
'%dh'
%
(
t
/
3600
)
elif
segment_time
>=
60
:
# Show minutes.
time_offset
=
'%dm'
%
(
t
/
60
)
elif
segment_time
>=
1
:
# Show seconds.
time_offset
=
'%ds'
%
t
else
:
# Show fractions.
time_offset
=
'%.2fs'
%
t
divs
.
append
({
'store_len'
:
store_len
,
'load_len'
:
load_len
,
'trans_len'
:
max
(
segment_height
-
store_len
-
load_len
,
0
),
'store_count'
:
div
[
'stores'
],
'load_count'
:
div
[
'loads'
],
'connections'
:
div
[
'connections'
],
'start'
:
div
[
'start'
],
'end'
:
div
[
'end'
],
'time_offset'
:
time_offset
,
})
if
analysis
:
start_time
=
DateTime
(
divs
[
0
][
'start'
]).
aCommonZ
()
end_time
=
DateTime
(
divs
[
-
1
][
'end'
]).
aCommonZ
()
else
:
start_time
=
''
end_time
=
''
res
=
{
'start_time'
:
start_time
,
'end_time'
:
end_time
,
'divs'
:
divs
,
'total_store_count'
:
total_store_count
,
'total_load_count'
:
total_load_count
,
'total_connections'
:
total_connections
,
}
return
res
InitializeClass
(
CacheManager
)
src/App/dtml/activity.dtml
deleted
100644 → 0
View file @
006ee05c
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<h3>Recent Database Activity</h3>
<dtml-with expr="getActivityChartData(200, REQUEST)" mapping>
<table>
<tr>
<th valign="top">Keep History (seconds)</th>
<td>
<form method="POST" action="&dtml-URL1;/manage_setHistoryLength">
<input type="text" name="length" value="&dtml-getHistoryLength;" />
<input type="submit" name="submit" value="Save changes" />
</form>
</td>
</tr>
<tr>
<th valign="top">Displayed Range</th>
<td>&dtml-start_time; to<br />
&dtml-end_time;</td>
</tr>
<tr>
<th></th>
<td>
<form method="GET" action="&dtml-URL;">
<input type="submit" name="submit" value="Show current chart" />
</form>
</td>
</tr>
</table>
<p></p>
<div align="center">
<table>
<tr>
<th align="left"><font color="#ff0000">Object stores</font></th>
<dtml-in divs mapping>
<th align="right"><dtml-let url="REQUEST['URL'] +
('?chart_start=%s&chart_end=%s'
% (start, end))"><a href="&dtml-url;"><font
color="#ff0000">&dtml-store_count;</font></a></dtml-let></th>
</dtml-in>
<th align="left"> Total:
<font color="#ff0000">&dtml-total_store_count;</font>
</th>
</tr>
<tr>
<th align="left" valign="top"><font color="#000080">Object loads</font></th>
<dtml-in divs mapping>
<th align="right"><dtml-let url="REQUEST['URL'] +
('?chart_start=%s&chart_end=%s'
% (start, end))"><a href="&dtml-url;"><font
color="#000080">&dtml-load_count;</font></a></dtml-let></th>
</dtml-in>
<th align="left" valign="top"> Total:
<font color="#000080">&dtml-total_load_count;</font>
</th>
</tr>
<tr>
<th align="left">Connections</th>
<dtml-in divs mapping>
<th align="right">&dtml-connections;</th>
</dtml-in>
<th align="left"> Total:
&dtml-total_connections;
</th>
</tr>
<tr>
<th></th>
<dtml-in divs mapping>
<th align="right"><font size="-2">&dtml-time_offset;</font></th>
</dtml-in>
<th></th>
</tr>
</table>
</div>
</dtml-with>
<dtml-var manage_page_footer>
src/App/dtml/cacheGC.dtml
deleted
100644 → 0
View file @
006ee05c
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<br />
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr class="section-bar">
<td colspan="2" align="left">
<div class="form-label">
Minimize
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-text">
Remove all objects from all ZODB in-memory caches
</td>
<td>
<form action="&dtml-URL1;/manage_minimize" method=GET>
<div class="form-element">
<input type="submit" name="submit" value="Minimize" />
</div>
</form>
</td>
</tr>
</table>
<dtml-if show_cache_detail>
<h4>Cache Details</h4><P>
<table border><tr><th>Object Class</th><th>Count</th></tr>
<dtml-in cache_detail>
<tr><td>&dtml-sequence-key;</td><td>&dtml-sequence-item;</td></tr>
</dtml-in>
</table>
</dtml-if>
<dtml-if show_cache_extreme_detail>
<h4>Objects in the cache</h4><P>
<table border><tr><th>Object ID</th>
<th>Object Class</th>
<th>Reference Count</th>
<th>References</th>
</tr>
<dtml-in cache_extreme_detail mapping>
<tr><td>&dtml-oid;</td>
<td>&dtml-klass;</td>
<td>&dtml-rc;</td>
<td>&dtml-references;</td>
</tr>
</dtml-in>
</table>
</dtml-if>
<dtml-var manage_page_footer>
src/App/dtml/cacheParameters.dtml
deleted
100644 → 0
View file @
006ee05c
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<br />
<table>
<tr>
<td align="left">
<div class="form-label">
Total number of objects in the database
</div>
</td>
<td>
<div class="form-text">
&dtml-database_size;
</div>
</td>
</tr>
<tr>
<td align="left">
<div class="form-label">
Total number of objects in memory from all caches
</div>
</td>
<td>
<div class="form-text">
&dtml-cache_length;
</div>
</td>
</tr>
<tr>
<td align="left">
<div class="form-label">
Target number of objects in memory per cache
</div>
</td>
<td>
<div class="form-text">
&dtml-cache_size;
</div>
</td>
</tr>
<tr>
<td align="left">
<div class="form-label">
Target memory size per cache in bytes
</div>
</td>
<td>
<div class="form-text">
&dtml-cache_length_bytes;
</div>
</td>
</tr>
<tr>
<td align="left" colspan=2>
<div class="form-label">
Total number of objects in each cache:
</div>
</td>
</tr>
<tr class="list-header">
<th><div class="list-item">Cache Name</div></th>
<th><div class="list-item">Number of active objects</div></th>
<th><div class="list-item">Total active and non-active objects</div></th>
</tr>
<dtml-in cache_detail_length mapping>
<dtml-if name="sequence-odd"><tr class="row-normal">
<dtml-else><tr class="row-hilite"></dtml-if>
<td><div class="form-text">&dtml-connection;</div></td>
<td><div class="form-text">&dtml-ngsize;</div></td>
<td><div class="form-text">&dtml-size;</div></td>
</tr>
</dtml-in>
<tr class="row-hilite">
<td><div class="list-item">Total</div></td>
<td><div class="list-item">&dtml-cache_length;</div></td>
<td><div class="list-item"></div></td>
</tr>
</table>
<dtml-if show_cache_detail>
<h4>Cache Details</h4><P>
<table border><tr><th>Object Class</th><th>Count</th></tr>
<dtml-in cache_detail>
<tr><td>&dtml-sequence-key;</td><td>&dtml-sequence-item;</td></tr>
</dtml-in>
</table>
</dtml-if>
<dtml-if show_cache_extreme_detail>
<h4>Objects in the cache</h4><P>
<table border><tr><th>Object ID</th>
<th>Object Class</th>
<th>Reference Count</th>
<th>References</th>
</tr>
<dtml-in cache_extreme_detail mapping>
<tr><td>&dtml-oid;</td>
<td>&dtml-klass;</td>
<td>&dtml-rc;</td>
<td>&dtml-references;</td>
</tr>
</dtml-in>
</table>
</dtml-if>
<dtml-var manage_page_footer>
src/App/dtml/cpContents.dtml
View file @
c8e4cd5c
...
...
@@ -5,7 +5,6 @@
The Control Panel provides access to system information.
</p>
<form action="&dtml-URL1;" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
...
...
@@ -87,27 +86,11 @@ The Control Panel provides access to system information.
</td>
<td align="left" valign="top">
<div class="form-text">
&dtml-process_id;
(&dtml-thread_get_ident;)
&dtml-process_id;
</div>
</td>
</tr>
</table>
</form>
<table cellspacing="0" cellpadding="2" border="0">
<dtml-in objectItems>
<tr>
<td width="16" align="left" valign="top"></td>
<td align="left" valign="top">
<div class="list-item">
<a href="&dtml.url_quote-sequence-key;/manage_workspace">
&dtml-title;
</a>
</div>
</td>
</tr>
</dtml-in objectValues>
</table>
<dtml-var manage_page_footer>
src/App/dtml/dbMain.dtml
View file @
c8e4cd5c
...
...
@@ -3,8 +3,6 @@
<p class="form-help">
The Database Manager allows you to view database status information.
It also allows you to perform maintenance tasks such as database packing
and cache management.
</p>
<table cellspacing="0" cellpadding="2" border="0">
...
...
@@ -33,26 +31,111 @@ and cache management.
</td>
</tr>
</table>
<br />
<form action="manage_pack" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<span class="form-text">
Click <em>pack</em> to pack the Zope database, removing previous revisions
of objects that are older than</span>
<input type="text" name="days:float" value="0" size="3">
<span class="form-text"> days.</span>
<td align="left">
<div class="form-label">
Total number of objects in the database
</div>
</td>
<td>
<div class="form-text">
&dtml-database_size;
</div>
</td>
</tr>
<tr>
<td align="left">
<div class="form-label">
Total number of objects in memory from all caches
</div>
</td>
<td>
<div class="form-text">
&dtml-cache_length;
</div>
</td>
</tr>
<tr>
<td align="left">
<div class="form-label">
Target number of objects in memory per cache
</div>
</td>
<td>
<div class="form-text">
&dtml-cache_size;
</div>
</td>
</tr>
<tr>
<td align="left">
<div class="form-label">
Target memory size per cache in bytes
</div>
</td>
<td>
<div class="form-text">
&dtml-cache_length_bytes;
</div>
</td>
</tr>
</table>
<br />
<table width="100%">
<tr>
<td align="left" colspan=2>
<div class="form-label">
Total number of objects in each cache:
</div>
</td>
</tr>
<tr class="list-header">
<th><div class="list-item">Cache Name</div></th>
<th><div class="list-item">Number of active objects</div></th>
<th><div class="list-item">Total active and non-active objects</div></th>
</tr>
<dtml-in cache_detail_length mapping>
<dtml-if name="sequence-odd"><tr class="row-normal">
<dtml-else><tr class="row-hilite"></dtml-if>
<td><div class="form-text">&dtml-connection;</div></td>
<td><div class="form-text">&dtml-ngsize;</div></td>
<td><div class="form-text">&dtml-size;</div></td>
</tr>
</dtml-in>
<tr class="row-hilite">
<td><div class="list-item">Total</div></td>
<td><div class="list-item">&dtml-cache_length;</div></td>
<td><div class="list-item"></div></td>
</tr>
</table>
<br />
<table width="100%">
<tr class="section-bar">
<td colspan="2" align="left">
<div class="form-label">
Minimize
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-text">
Remove all objects from all ZODB in-memory caches.
</td>
<td>
<form action="&dtml-URL1;/manage_minimize" method="POST">
<div class="form-element">
<input type="submit" name="submit" value="
Pack"
>
<input type="submit" name="submit" value="
Minimize" /
>
</div>
</form>
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
src/App/dtml/editFactory.dtml
deleted
100644 → 0
View file @
006ee05c
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<p class="form-help">
The <strong>initial method</strong> is the method that will be invoked
when a user adds a new object. This must be one of the objects in the
product, typically a Document.
</p>
<form action="manage_edit" method="POST">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<div class="form-text">
&dtml-id;
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
Title
</div>
</td>
<td align="left" valign="top">
<input type="TEXT" name="title"size="40" value="&dtml-title;" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Add list name
</div>
</td>
<td align="left" valign="top">
<input type="TEXT" name="object_type" size="40" value="&dtml-object_type;" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Initial method
</div>
</td>
<td align="left" valign="top">
<div class="form-element">
<select name="initial">
<dtml-in objectIds>
<option <dtml-if
expr="_.string.strip(_['sequence-item'])==initial"> selected</dtml-if
>>&dtml-sequence-item;</option>
</dtml-in>
</select>
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Permission
</div>
</td>
<td align="left" valign="top">
<div class="form-element">
<select name=permission>
<dtml-in possible_permissions>
<option <dtml-if
"_['sequence-item']==permission">selected</dtml-if
>>&dtml-sequence-item;</option>
</dtml-in>
</select>
</td>
</tr>
<tr>
<td></td>
<td>
<div class="form-element">
<input type="submit" name="submit" value="Save Changes">
</div>
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
src/App/dtml/manage_style_test.dtml
deleted
100644 → 0
View file @
006ee05c
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html
lang=
"en"
>
<head>
<title>
System Stylesheet Test
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"&dtml.url_quote-SCRIPT_NAME;/manage_style_css"
>
</head>
<body
bgcolor=
"#ffffff"
link=
"#000099"
alink=
"#000099"
vlink=
"#555555"
>
&dtml-HTTP_USER_AGENT;
<h3>
Text Styles
</h3>
<p
class=
"small-st"
>
This is small-st.
This is small-st.
This is small-st.
This is small-st.
</p>
<p
class=
"small-un"
>
This is small-un.
This is small-un.
This is small-un.
This is small-un.
</p>
<p
class=
"small-em"
>
This is small-em.
This is small-em.
This is small-em.
This is small-em.
</p>
<p
class=
"small-tx"
>
This is small-tx.
This is small-tx.
This is small-tx.
This is small-tx.
</p>
<p
class=
"normal-st"
>
This is normal-st.
This is normal-st.
This is normal-st.
This is normal-st.
</p>
<p
class=
"normal-un"
>
This is normal-un.
This is normal-un.
This is normal-un.
This is normal-un.
</p>
<p
class=
"normal-em"
>
This is normal-em.
This is normal-em.
This is normal-em.
This is normal-em.
</p>
<p
class=
"normal-tx"
>
This is normal-tx.
This is normal-tx.
This is normal-tx.
This is normal-tx.
</p>
<p
class=
"large-st"
>
This is large-st.
This is large-st.
This is large-st.
This is large-st.
</p>
<p
class=
"large-un"
>
This is large-un.
This is large-un.
This is large-un.
This is large-un.
</p>
<p
class=
"large-em"
>
This is large-em.
This is large-em.
This is large-em.
This is large-em.
</p>
<p
class=
"large-tx"
>
This is large-tx.
This is large-tx.
This is large-tx.
This is large-tx.
</p>
<table><tr>
<td
class=
"infobox"
>
<div>
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
</td></tr></table>
<h3>
Form Elements
</h3>
<form>
<div
class=
"form-element"
>
<input
type=
"text"
size=
"30"
class=
"form-element"
value=
"This is some text"
/>
</div>
<br>
<div
class=
"form-element"
>
<select
name=
"dummy_1"
class=
"form-element"
size=
"1"
>
<option>
This is option 1
</option>
<option>
This is option 2
</option>
<option>
This is option 3
</option>
<option>
This is option 4
</option>
</select>
</div>
<br>
<div
class=
"form-element"
>
<input
type=
"checkbox"
name=
"c_1"
class=
"form-element"
value=
"1"
/>
This is option 1
<br>
<input
type=
"checkbox"
name=
"c_2"
class=
"form-element"
value=
"1"
/>
This is option 2
<br>
<input
type=
"checkbox"
name=
"c_3"
class=
"form-element"
value=
"1"
/>
This is option 3
</div>
<br>
<div
class=
"form-element"
>
<input
type=
"radio"
name=
"r_1"
class=
"form-element"
value=
"1"
/>
This is option 1
<br>
<input
type=
"radio"
name=
"r_1"
class=
"form-element"
value=
"1"
/>
This is option 2
<br>
<input
type=
"radio"
name=
"r_1"
class=
"form-element"
value=
"1"
/>
This is option 3
</div>
<br>
<div
class=
"form-mono"
>
<textarea
name=
"dummy_2"
rows=
"4"
cols=
"60"
>
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</textarea>
</div>
<br>
<div
class=
"form-element"
>
<input
type=
"button"
name=
"b1"
value=
"Action 1"
class=
"form-element"
/>
<input
type=
"submit"
name=
"b1"
value=
"Action 2"
class=
"form-element"
/>
<input
type=
"submit"
name=
"b1"
value=
"Action 3"
class=
"form-element"
/>
<input
type=
"submit"
name=
"b1"
value=
"Action 4"
class=
"form-element"
/>
</div>
</body>
</html>
src/App/dtml/menu.dtml
View file @
c8e4cd5c
<dtml-var manage_page_header>
<table width="100%" cellspacing="0" border="0">
<table width="100%">
<tr bgcolor="#eeeeee">
<td>
<a href="Control_Panel/manage_main" target="manage_main">
Control Panel
</a>
</td>
</tr>
</table>
<br />
<table width="100%">
<tr bgcolor="#000000">
<td valign="top" nowrap="nowrap">
<a href="manage_workspace" target="manage_main" style="color: #ffffff;">
...
...
@@ -13,11 +24,11 @@
</td>
</tr>
</table>
<dtml-tree nowrap=1>
<a href="&dtml.url_quote-tree-item-url;/manage_workspace"
target="manage_main">&dtml-id;</a>
</dtml-tree>
<br />
<table width="100%" bgcolor="#6699cc">
...
...
src/App/dtml/zope_quick_start.dtml
deleted
100644 → 0
View file @
006ee05c
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>
Zope QuickStart
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"&dtml-BASEPATH1;/manage_page_style.css"
/>
</head>
<body
bgcolor=
"#ffffff"
link=
"#000099"
alink=
"#000099"
vlink=
"#000099"
>
<dtml-var
"
manage_form_title
(
this
(),
_
,
form_title=
'Zope 2'
,
)"
>
<dtml-if
expr=
"_.hasattr (PARENTS[0].acl_users, 'hasUsers') and not PARENTS[0].acl_users.hasUsers()"
>
<div
class=
"system-msg"
>
<h3>
You have not created any users in this Zope instance. In order to log in and
manage this Zope instance, you'll need to add an administrative user account.
</h3>
<p>
You can create an administrative user account via the "addzope2user"
command from a shell.
<b>
Note: You'll need to shut Zope itself down before
"addzope2user" will work. Restart Zope after executing this command in
order to log in.
</b>
</p>
</div>
</dtml-if>
<p>
The owner of this site has not yet added any content.
</p>
</body>
</html>
src/App/tests/test_ApplicationManager.py
View file @
c8e4cd5c
This diff is collapsed.
Click to expand it.
src/App/tests/test_cachemanager.py
deleted
100644 → 0
View file @
006ee05c
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# 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.
#
##############################################################################
"""Tests for the CacheManager.
"""
import
unittest
class
DummyConnection
:
def
__init__
(
self
,
db
):
self
.
__db
=
db
def
db
(
self
):
return
self
.
__db
class
DummyDB
:
def
__init__
(
self
,
cache_size
):
self
.
_set_sizes
(
cache_size
)
def
_set_sizes
(
self
,
cache_size
):
self
.
__cache_size
=
cache_size
def
getCacheSize
(
self
):
return
self
.
__cache_size
class
CacheManagerTestCase
(
unittest
.
TestCase
):
def
_getManagerClass
(
self
):
from
App.CacheManager
import
CacheManager
class
TestCacheManager
(
CacheManager
):
# Derived CacheManager that fakes enough of the DatabaseManager to
# make it possible to test at least some parts of the CacheManager.
def
__init__
(
self
,
connection
):
self
.
_p_jar
=
connection
return
TestCacheManager
def
test_cache_size
(
self
):
db
=
DummyDB
(
42
)
connection
=
DummyConnection
(
db
)
manager
=
self
.
_getManagerClass
()(
connection
)
self
.
assertEqual
(
manager
.
cache_size
(),
42
)
db
.
_set_sizes
(
12
)
self
.
assertEqual
(
manager
.
cache_size
(),
12
)
src/OFS/Application.py
View file @
c8e4cd5c
...
...
@@ -63,13 +63,6 @@ class Application(ApplicationDefaultPermissions, Folder.Folder, FindSupport):
__error_log__
=
None
isTopLevelPrincipiaApplicationObject
=
1
manage_options
=
((
Folder
.
Folder
.
manage_options
[
0
],
Folder
.
Folder
.
manage_options
[
1
],
{
'label'
:
'Control Panel'
,
'action'
:
'Control_Panel/manage_main'
},
)
+
Folder
.
Folder
.
manage_options
[
2
:]
)
p_
=
misc_
.
p_
misc_
=
misc_
.
misc_
_reserved_names
=
(
'Control_Panel'
,
)
...
...
@@ -213,22 +206,21 @@ class AppInitializer:
def
initialize
(
self
):
# make sure to preserve relative ordering of calls below.
self
.
install_
cp_and_products
()
self
.
install_
app_manager
()
self
.
install_required_roles
()
self
.
install_inituser
()
self
.
install_products
()
self
.
install_standards
()
self
.
install_virtual_hosting
()
def
install_
cp_and_products
(
self
):
def
install_
app_manager
(
self
):
global
APP_MANAGER
APP_MANAGER
=
ApplicationManager
()
APP_MANAGER
.
_init
()
# Remove persistent Control Panel.
app
=
self
.
getApp
()
app
.
_p_activate
()
# Remove Control Panel.
if
'Control_Panel'
in
app
.
__dict__
.
keys
():
del
app
.
__dict__
[
'Control_Panel'
]
app
.
_objects
=
tuple
(
i
for
i
in
app
.
_objects
...
...
src/OFS/tests/testAppInitializer.py
View file @
c8e4cd5c
...
...
@@ -86,14 +86,6 @@ class TestInitialization(unittest.TestCase):
app
=
getApp
()
return
AppInitializer
(
app
)
def
test_install_cp_and_products
(
self
):
self
.
configure
(
good_cfg
)
i
=
self
.
getOne
()
app
=
i
.
getApp
()
i
.
install_cp_and_products
()
self
.
assertTrue
(
hasattr
(
app
,
'Control_Panel'
))
self
.
assertEqual
(
app
.
Control_Panel
.
meta_type
,
'Control Panel'
)
def
test_install_virtual_hosting
(
self
):
self
.
configure
(
good_cfg
)
i
=
self
.
getOne
()
...
...
src/Zope2/App/startup.py
View file @
c8e4cd5c
...
...
@@ -118,19 +118,10 @@ def startup():
notify
(
DatabaseOpened
(
DB
))
Globals
.
BobobaseName
=
DB
.
getName
()
if
DB
.
getActivityMonitor
()
is
None
:
from
ZODB.ActivityMonitor
import
ActivityMonitor
DB
.
setActivityMonitor
(
ActivityMonitor
())
Globals
.
DB
=
DB
Zope2
.
DB
=
DB
# Hook for providing multiple transaction object manager undo support:
Globals
.
UndoManager
=
DB
Globals
.
opened
.
append
(
DB
)
import
ClassFactory
DB
.
classFactory
=
ClassFactory
.
ClassFactory
...
...
src/Zope2/Startup/datatypes.py
View file @
c8e4cd5c
...
...
@@ -157,8 +157,6 @@ class ZopeDatabase(ZODBDatabase):
DB
.
klass
=
self
.
config
.
connection_class
if
self
.
config
.
class_factory
is
not
None
:
DB
.
classFactory
=
self
.
config
.
class_factory
from
ZODB.ActivityMonitor
import
ActivityMonitor
DB
.
setActivityMonitor
(
ActivityMonitor
())
return
DB
def
getName
(
self
):
...
...
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