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
9a56771d
Commit
9a56771d
authored
Jul 22, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protected the connection table with a lock.
parent
69beac1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
lib/python/Products/ZGadflyDA/DA.py
lib/python/Products/ZGadflyDA/DA.py
+25
-20
No files found.
lib/python/Products/ZGadflyDA/DA.py
View file @
9a56771d
...
@@ -85,15 +85,16 @@
...
@@ -85,15 +85,16 @@
database_type
=
'Gadfly'
database_type
=
'Gadfly'
__doc__
=
'''%s Database Connection
__doc__
=
'''%s Database Connection
$Id: DA.py,v 1.
7 1999/03/10 00:15:29 kl
m Exp $'''
%
database_type
$Id: DA.py,v 1.
8 1999/07/22 16:10:04 ji
m Exp $'''
%
database_type
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
from
db
import
DB
,
manage_DataSources
from
db
import
DB
,
manage_DataSources
import
sys
,
DABase
,
Globals
import
sys
,
DABase
,
Globals
import
Shared.DC.ZRDB.Connection
import
Shared.DC.ZRDB.Connection
,
ThreadLock
_Connection
=
Shared
.
DC
.
ZRDB
.
Connection
.
Connection
_Connection
=
Shared
.
DC
.
ZRDB
.
Connection
.
Connection
_connections
=
{}
_connections
=
{}
_connections_lock
=
ThreadLock
.
allocate_lock
()
data_sources
=
manage_DataSources
data_sources
=
manage_DataSources
...
@@ -140,23 +141,27 @@ class Connection(DABase.Connection):
...
@@ -140,23 +141,27 @@ class Connection(DABase.Connection):
return
s
return
s
def
connect
(
self
,
s
):
def
connect
(
self
,
s
):
c
=
_connections
_connections_lock
.
acquire
()
if
c
.
has_key
(
s
):
c
=
self
.
_v_database_connection
=
c
[
s
]
if
not
c
.
opened
:
c
.
open
()
return
self
try
:
try
:
c
=
_connections
if
c
.
has_key
(
s
):
c
=
self
.
_v_database_connection
=
c
[
s
]
if
not
c
.
opened
:
c
.
open
()
return
self
try
:
try
:
self
.
_v_database_connection
=
c
[
s
]
=
DB
(
s
)
try
:
except
:
self
.
_v_database_connection
=
c
[
s
]
=
DB
(
s
)
t
,
v
,
tb
=
sys
.
exc_info
()
except
:
raise
'BadRequest'
,
(
t
,
v
,
tb
=
sys
.
exc_info
()
'<strong>Invalid connection string: </strong>'
raise
'BadRequest'
,
(
'<CODE>%s</CODE><br>
\
n
'
'<strong>Invalid connection string: </strong>'
'<!--
\
n
%s
\
n
%s
\
n
-->
\
n
'
'<CODE>%s</CODE><br>
\
n
'
%
(
s
,
t
,
v
)),
tb
'<!--
\
n
%s
\
n
%s
\
n
-->
\
n
'
finally
:
tb
=
None
%
(
s
,
t
,
v
)),
tb
finally
:
tb
=
None
return
self
return
self
finally
:
_connections_lock
.
release
()
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