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
2bd4581c
Commit
2bd4581c
authored
Mar 18, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added doc strings.
parent
a78cee45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
9 deletions
+65
-9
lib/python/Shared/DC/ZRDB/DA.py
lib/python/Shared/DC/ZRDB/DA.py
+65
-9
No files found.
lib/python/Shared/DC/ZRDB/DA.py
View file @
2bd4581c
...
...
@@ -11,8 +11,8 @@
__doc__
=
'''Generic Database adapter
$Id: DA.py,v 1.
39 1998/03/17 21:16:08 brian
Exp $'''
__version__
=
'$Revision: 1.
39
$'
[
11
:
-
2
]
$Id: DA.py,v 1.
40 1998/03/18 13:45:04 jim
Exp $'''
__version__
=
'$Revision: 1.
40
$'
[
11
:
-
2
]
import
OFS.SimpleItem
,
Aqueduct
.
Aqueduct
,
Aqueduct
.
RDB
import
DocumentTemplate
,
marshal
,
md5
,
base64
,
DateTime
,
Acquisition
,
os
...
...
@@ -62,11 +62,12 @@ class DA(
# Specify how individual operations add up to "permissions":
__ac_permissions__
=
(
(
'View management screens'
,
(
'manage_tabs'
,
'manage_main'
,
'index_html'
,
'manage_
properties'
,
'manage_
advancedForm'
,
'manage_advancedForm'
,
)),
(
'Change permissions'
,
(
'manage_access'
,)
),
(
'Change'
,
(
'manage_edit'
,
'manage_advanced'
)
),
(
'Test'
,
(
'manage_testForm'
,
'manage_test'
)
),
(
'Use'
,
(
'__call__'
,)),
(
'Shared permission'
,
[
''
,]),
)
...
...
@@ -95,7 +96,18 @@ class DA(
del
self
.
rotor
def
manage_edit
(
self
,
title
,
connection_id
,
arguments
,
template
,
REQUEST
=
None
):
'change query properties'
"""Change database method properties
The 'connection_id' argument is the id of a database connection
that resides in the current folder or in a folder above the
current folder. The database should understand SQL.
The 'arguments' argument is a string containing an arguments
specification, as would be given in the SQL method cration form.
The 'template' argument is a string containing the source for the
SQL Template.
"""
self
.
title
=
title
self
.
connection_id
=
connection_id
self
.
arguments_src
=
arguments
...
...
@@ -109,7 +121,38 @@ class DA(
def
manage_advanced
(
self
,
key
,
max_rows
,
max_cache
,
cache_time
,
class_name
,
class_file
,
REQUEST
):
'Change advanced parameters'
"""Change advanced properties
The arguments are:
key -- The encryption key used for communication with Principia
network clients.
max_rows -- The maximum number of rows to be returned from a query.
max_cache -- The maximum number of results to cache
cache_time -- The maximum amound of time to use a cached result.
class_name -- The name of a class that provides additional
attributes for result record objects. This class will be a
base class of the result record class.
class_file -- The name of the file containing the class
definition.
The class file normally resides in the 'Extensions'
directory, however, the file name may have a prefix of
'product.', indicating that it should be found in a product
directory.
For example, if the class file is: 'ACMEWidgets.foo', then an
attempt will first be made to use the file
'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this
failes, then the file 'Extensions/ACMEWidgets.foo.py' will be
used.
"""
self
.
_setKey
(
key
)
self
.
max_rows_
=
max_rows
self
.
max_cache_
,
self
.
cache_time_
=
max_cache
,
cache_time
...
...
@@ -120,19 +163,19 @@ class DA(
if
REQUEST
:
return
self
.
manage_editedDialog
(
REQUEST
)
def
manage_testForm
(
self
,
REQUEST
):
"
""Provide testing interface""
"
"
"
input_src
=
default_input_form
(
self
.
title_or_id
(),
self
.
_arg
,
'manage_test'
,
'<!--#var manage_tabs-->'
)
return
DocumentTemplate
.
HTML
(
input_src
)(
self
,
REQUEST
,
HTTP_REFERER
=
''
)
def
manage_test
(
self
,
REQUEST
):
'
Perform an actual query
'
'
'
src
=
"Could not render the query template!"
result
=
()
try
:
src
=
self
(
REQUEST
,
1
)
src
=
self
(
REQUEST
,
src__
=
1
)
result
=
self
(
REQUEST
)
r
=
custom_default_report
(
self
.
id
,
result
)
except
:
...
...
@@ -190,7 +233,17 @@ class DA(
return
result
def
__call__
(
self
,
REQUEST
=
None
,
src__
=
0
,
**
kw
):
def
__call__
(
self
,
REQUEST
=
None
,
__ick__
=
None
,
src__
=
0
,
**
kw
):
"""Call the database method
The arguments to the method should be passed via keyword
arguments, or in a single mapping object. If no arguments are
given, and if the method was invoked through the Web, then the
method will try to acquire and use the Web REQUEST object as
the argument mapping.
The returned value is a sequence of record objects.
"""
if
REQUEST
is
None
:
if
kw
:
REQUEST
=
kw
...
...
@@ -372,6 +425,9 @@ def getBrain(self,
##############################################################################
#
# $Log: DA.py,v $
# Revision 1.40 1998/03/18 13:45:04 jim
# Added doc strings.
#
# Revision 1.39 1998/03/17 21:16:08 brian
# Changed __call__ to detect whether it is being called via the
# web, or via dtml, and bind itself accordingly.
...
...
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