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
1132c94a
Commit
1132c94a
authored
Sep 25, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new interfaces
parent
9e603ad7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
38 deletions
+36
-38
lib/python/Shared/DC/ZRDB/DA.py
lib/python/Shared/DC/ZRDB/DA.py
+36
-38
No files found.
lib/python/Shared/DC/ZRDB/DA.py
View file @
1132c94a
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
__doc__
=
'''Generic Database adapter
__doc__
=
'''Generic Database adapter
$Id: DA.py,v 1.
8 1997/09/25 17:35:3
0 jim Exp $'''
$Id: DA.py,v 1.
9 1997/09/25 18:41:2
0 jim Exp $'''
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
import
string
,
OFS
.
Folder
,
Aqueduct
.
Aqueduct
,
Aqueduct
.
RDB
import
string
,
OFS
.
Folder
,
Aqueduct
.
Aqueduct
,
Aqueduct
.
RDB
import
DocumentTemplate
,
marshal
,
md5
,
zlib
,
base64
,
DateTime
,
Acquisition
import
DocumentTemplate
,
marshal
,
md5
,
zlib
,
base64
,
DateTime
,
Acquisition
...
@@ -23,6 +23,7 @@ from Globals import Persistent, HTMLFile, MessageDialog
...
@@ -23,6 +23,7 @@ from Globals import Persistent, HTMLFile, MessageDialog
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
log_file
=
None
log_file
=
None
import
sys
,
traceback
import
sys
,
traceback
from
DocumentTemplate
import
HTML
class
Folder
(
OFS
.
Folder
.
Folder
):
class
Folder
(
OFS
.
Folder
.
Folder
):
icon
=
'AqueductDA/DBAdapterFolder_icon.gif'
icon
=
'AqueductDA/DBAdapterFolder_icon.gif'
...
@@ -106,51 +107,55 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
...
@@ -106,51 +107,55 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
icon
=
'AqueductDA/DBAdapter_icon.gif'
icon
=
'AqueductDA/DBAdapter_icon.gif'
meta_type
=
'Aqueduct Database Adapter'
meta_type
=
'Aqueduct Database Adapter'
hasAqueductClientInterface
=
1
hasAqueductClientInterface
=
1
_col
=
None
manage
=
HTMLFile
(
'AqueductDA/edit'
)
manage
=
HTMLFile
(
'AqueductDA/edit'
)
def
__init__
(
self
,
id
=
''
,
key
=
''
,
arguments
=
''
,
template
=
''
,
title
=
''
):
def
__init__
(
self
,
id
=
''
,
key
=
''
,
arguments
=
''
,
template
=
''
,
title
=
''
):
if
not
id
:
return
if
not
id
:
return
self
.
id
=
id
self
.
id
=
id
self
.
report_src
=
default_report_src
self
.
manage_edit
(
key
,
title
,
arguments
,
template
)
self
.
manage_edit
(
key
,
title
,
arguments
,
template
)
def
quoted_src
(
self
):
return
quotedHTML
(
self
.
src
)
def
quoted_src
(
self
):
return
quotedHTML
(
self
.
src
)
def
manage_edit
(
self
,
key
,
title
,
arguments
,
template
,
URL2
=
''
):
def
manage_edit
(
self
,
key
,
title
,
arguments
,
template
,
REQUEST
=
None
):
'change query properties'
'change query properties'
self
.
title
=
title
self
.
title
=
title
self
.
key
=
key
self
.
key
=
key
self
.
rotor
=
Rotor
(
key
)
self
.
rotor
=
Rotor
(
key
)
self
.
arguments_src
=
arguments
self
.
arguments_src
=
arguments
self
.
arguments
=
parse
(
arguments
)
self
.
_arg
=
parse
(
arguments
)
self
.
src
=
template
self
.
src
=
template
self
.
template
=
DocumentTemplate
.
HTML
(
template
)
self
.
template
=
DocumentTemplate
.
HTML
(
template
)
self
.
manage_testForm
=
DocumentTemplate
.
HTML
(
if
REQUEST
:
default_input_form
(
self
.
id
,
self
.
arguments
,
action
=
'manage_test'
),
__name__
=
'test input form'
)
if
URL2
:
return
MessageDialog
(
return
MessageDialog
(
title
=
self
.
id
+
' changed'
,
title
=
self
.
id
+
' changed'
,
message
=
self
.
id
+
' has been changed sucessfully.'
,
message
=
self
.
id
+
' has been changed sucessfully.'
,
action
=
URL2
+
'/manage_main'
,
action
=
REQUEST
[
'URL2'
]
+
'/manage_main'
,
)
)
def
query_data
(
self
,
REQUEST
):
try
:
DB__
=
self
.
database_connection
()
except
:
raise
'Database Error'
,
(
'%s is not connected to a database'
%
self
.
id
)
argdata
=
self
.
_argdata
(
REQUEST
,
1
)
def
manage_testForm
(
self
,
REQUEST
):
query_string
=
self
.
_query_string
(
argdata
,
'manage_test'
)
"""Provide testing interface"""
query
=
self
.
template
(
self
,
argdata
)
input_src
=
default_input_form
(
self
.
title_or_id
(),
result
=
DB__
.
query
(
query
)
self
.
_arg
,
'manage_test'
)
result
=
Aqueduct
.
RDB
.
RDB
(
StringIO
(
result
))
return
HTML
(
input_src
)(
self
,
REQUEST
)
return
result
def
manage_test
(
self
,
REQUEST
):
'Perform an actual query'
def
manage_test
(
self
,
REQUEST
):
result
=
self
(
REQUEST
)
'Provide a simple interface for testing a query'
report
=
HTML
(
custom_default_report
(
self
.
id
,
result
))
return
apply
(
report
,(
self
,
REQUEST
),{
self
.
id
:
result
})
def
index_html
(
self
,
PARENT_URL
):
raise
'Redirect'
,
(
"%s/manage_testForm"
%
PARENT_URL
)
def
_searchable_arguments
(
self
):
return
self
.
_arg
def
_searchable_result_columns
(
self
):
return
self
.
_col
def
__call__
(
self
,
REQUEST
):
try
:
DB__
=
self
.
database_connection
()
try
:
DB__
=
self
.
database_connection
()
except
:
raise
'Database Error'
,
(
except
:
raise
'Database Error'
,
(
'%s is not connected to a database'
%
self
.
id
)
'%s is not connected to a database'
%
self
.
id
)
...
@@ -159,20 +164,10 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
...
@@ -159,20 +164,10 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
query_string
=
self
.
_query_string
(
argdata
,
'manage_test'
)
query_string
=
self
.
_query_string
(
argdata
,
'manage_test'
)
query
=
self
.
template
(
self
,
argdata
)
query
=
self
.
template
(
self
,
argdata
)
result
=
DB__
.
query
(
query
)
result
=
DB__
.
query
(
query
)
result
=
Aqueduct
.
RDB
.
RDB
(
StringIO
(
result
))
result
=
Aqueduct
.
RDB
.
File
(
StringIO
(
result
))
result_names
=
result
.
names
()
columns
=
result
.
_searchable_result_columns
()
report_src
=
custom_default_report
(
result
,
action
=
'/manage_testForm'
)
if
columns
!=
self
.
_col
:
self
.
_col
=
columns
return
result
if
result_names
!=
self
.
result_names
or
report_src
!=
self
.
report_src
:
self
.
result_names
=
names
self
.
report_src
=
report_src
report
=
DocumentTemplate
.
HTML
(
report_src
)
return
report
(
self
,
REQUEST
,
query_results
=
result
,
query_string
=
query_string
,
)
def
query
(
self
,
REQUEST
,
RESPONSE
):
def
query
(
self
,
REQUEST
,
RESPONSE
):
' '
' '
...
@@ -218,6 +213,9 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
...
@@ -218,6 +213,9 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
##############################################################################
##############################################################################
#
#
# $Log: DA.py,v $
# $Log: DA.py,v $
# Revision 1.9 1997/09/25 18:41:20 jim
# new interfaces
#
# Revision 1.8 1997/09/25 17:35:30 jim
# Revision 1.8 1997/09/25 17:35:30 jim
# Made some corrections for network behavior.
# Made some corrections for network behavior.
#
#
...
...
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