Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
3cf63481
Commit
3cf63481
authored
Apr 12, 2009
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored handling of local time because the old way, messing with
the time zone definition, only worked on Unix.
parent
dfb87148
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
src/ZEO/scripts/zeopack.test
src/ZEO/scripts/zeopack.test
+22
-25
No files found.
src/ZEO/scripts/zeopack.test
View file @
3cf63481
...
@@ -18,9 +18,13 @@ for our test:
...
@@ -18,9 +18,13 @@ for our test:
... repr(args)[1:-1],
... repr(args)[1:-1],
... '
,
'.join("%s=%r" % i for i in sorted(kw.items())),
... '
,
'.join("%s=%r" % i for i in sorted(kw.items())),
... )
... )
... def pack(self, *args, **kw):
... def pack(self, t=None, *args, **kw):
... print "pack(%s %s)" % (
... now = time.localtime(time.time())
... repr(args)[1:-1],
... local_midnight = time.mktime(now[:3]+(0, 0, 0)+now[6:])
... t -= local_midnight # adjust for tz
... t += 86400*7 # add a week to make sure we'
re
positive
...
print
"pack(%r,%s %s)"
%
(
...
t
,
repr
(
args
)[
1
:-
1
],
...
', '
.
join
(
"%s=%r"
%
i
for
i
in
sorted
(
kw
.
items
())),
...
', '
.
join
(
"%s=%r"
%
i
for
i
in
sorted
(
kw
.
items
())),
...
)
...
)
...
def
is_connected
(
self
)
:
...
def
is_connected
(
self
)
:
...
@@ -74,9 +78,6 @@ Since packing involved time, we'd better have our way with it:
...
@@ -74,9 +78,6 @@ Since packing involved time, we'd better have our way with it:
>>>
import
time
>>>
import
time
>>>
time_orig
=
time
.
time
>>>
time_orig
=
time
.
time
>>>
time
.
time
=
lambda
:
1237906517.0
>>>
time
.
time
=
lambda
:
1237906517.0
>>> import os
>>> oldtz = os.environ.get('
TZ
')
>>> os.environ['
TZ
'] = '
PST
+
07
'
>>>
sleep_orig
=
time
.
sleep
>>>
sleep_orig
=
time
.
sleep
>>>
def
sleep
(
t
)
:
>>>
def
sleep
(
t
)
:
...
print
'sleep(%r)'
%
t
...
print
'sleep(%r)'
%
t
...
@@ -87,11 +88,11 @@ Normally, we pass one or more TCP server specifications:
...
@@ -87,11 +88,11 @@ Normally, we pass one or more TCP server specifications:
>>>
main
([
"host1:8100"
,
"host1:8100:2"
])
>>>
main
([
"host1:8100"
,
"host1:8100:2"
])
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12379065
17.0, wait=True)
pack
(
6441
17.0
,
wait
=
True
)
close
()
close
()
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12379065
17.0, wait=True)
pack
(
6441
17.0
,
wait
=
True
)
close
()
close
()
We
can
also
pass
unix
-
domain
-
sockey
servers
using
the
-
u
option
:
We
can
also
pass
unix
-
domain
-
sockey
servers
using
the
-
u
option
:
...
@@ -99,19 +100,19 @@ We can also pass unix-domain-sockey servers using the -u option:
...
@@ -99,19 +100,19 @@ We can also pass unix-domain-sockey servers using the -u option:
>>>
main
([
"-ufoo"
,
"-ubar:spam"
,
"host1:8100"
,
"host1:8100:2"
])
>>>
main
([
"-ufoo"
,
"-ubar:spam"
,
"host1:8100"
,
"host1:8100:2"
])
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12379065
17.0, wait=True)
pack
(
6441
17.0
,
wait
=
True
)
close
()
close
()
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12379065
17.0, wait=True)
pack
(
6441
17.0
,
wait
=
True
)
close
()
close
()
ClientStorage
(
'foo'
,
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
ClientStorage
(
'foo'
,
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12379065
17.0, wait=True)
pack
(
6441
17.0
,
wait
=
True
)
close
()
close
()
ClientStorage
(
'bar'
,
read_only
=
1
,
storage
=
'spam'
,
wait
=
False
)
ClientStorage
(
'bar'
,
read_only
=
1
,
storage
=
'spam'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12379065
17.0, wait=True)
pack
(
6441
17.0
,
wait
=
True
)
close
()
close
()
The
-
d
option
causes
a
pack
time
the
given
number
of
days
earlier
to
The
-
d
option
causes
a
pack
time
the
given
number
of
days
earlier
to
...
@@ -120,19 +121,19 @@ be used:
...
@@ -120,19 +121,19 @@ be used:
>>>
main
([
"-ufoo"
,
"-ubar:spam"
,
"-d3"
,
"host1:8100"
,
"host1:8100:2"
])
>>>
main
([
"-ufoo"
,
"-ubar:spam"
,
"-d3"
,
"host1:8100"
,
"host1:8100:2"
])
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376473
17.0, wait=True)
pack
(
3849
17.0
,
wait
=
True
)
close
()
close
()
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376473
17.0, wait=True)
pack
(
3849
17.0
,
wait
=
True
)
close
()
close
()
ClientStorage
(
'foo'
,
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
ClientStorage
(
'foo'
,
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376473
17.0, wait=True)
pack
(
3849
17.0
,
wait
=
True
)
close
()
close
()
ClientStorage
(
'bar'
,
read_only
=
1
,
storage
=
'spam'
,
wait
=
False
)
ClientStorage
(
'bar'
,
read_only
=
1
,
storage
=
'spam'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376473
17.0, wait=True)
pack
(
3849
17.0
,
wait
=
True
)
close
()
close
()
The
-
t
option
allows
us
to
control
the
time
of
day
:
The
-
t
option
allows
us
to
control
the
time
of
day
:
...
@@ -140,11 +141,11 @@ The -t option allows us to control the time of day:
...
@@ -140,11 +141,11 @@ The -t option allows us to control the time of day:
>>>
main
([
"-ufoo"
,
"-d3"
,
"-t1:30"
,
"host1:8100:2"
])
>>>
main
([
"-ufoo"
,
"-d3"
,
"-t1:30"
,
"host1:8100:2"
])
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376242
00.0, wait=True)
pack
(
3510
00.0
,
wait
=
True
)
close
()
close
()
ClientStorage
(
'foo'
,
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
ClientStorage
(
'foo'
,
read_only
=
1
,
storage
=
'1'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376242
00.0, wait=True)
pack
(
3510
00.0
,
wait
=
True
)
close
()
close
()
Connection
timeout
Connection
timeout
...
@@ -164,7 +165,7 @@ seconds of waiting for a connect.
...
@@ -164,7 +165,7 @@ seconds of waiting for a connect.
is_connected
False
is_connected
False
sleep
(
1
)
sleep
(
1
)
is_connected
True
is_connected
True
pack(
12376242
00.0, wait=True)
pack
(
3510
00.0
,
wait
=
True
)
close
()
close
()
>>>
def
call_main
(
args
)
:
>>>
def
call_main
(
args
)
:
...
@@ -208,13 +209,13 @@ Legacy support
...
@@ -208,13 +209,13 @@ Legacy support
>>>
main
([
"-d3"
,
"-h"
,
"host1"
,
"-p"
,
"8100"
,
"-S"
,
"2"
])
>>>
main
([
"-d3"
,
"-h"
,
"host1"
,
"-p"
,
"8100"
,
"-S"
,
"2"
])
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
ClientStorage
((
'host1'
,
8100
),
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376473
17.0, wait=True)
pack
(
3849
17.0
,
wait
=
True
)
close
()
close
()
>>>
main
([
"-d3"
,
"-U"
,
"foo/bar"
,
"-S"
,
"2"
])
>>>
main
([
"-d3"
,
"-U"
,
"foo/bar"
,
"-S"
,
"2"
])
ClientStorage
(
'foo/bar'
,
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
ClientStorage
(
'foo/bar'
,
read_only
=
1
,
storage
=
'2'
,
wait
=
False
)
is_connected
True
is_connected
True
pack(
12376473
17.0, wait=True)
pack
(
3849
17.0
,
wait
=
True
)
close
()
close
()
Error
handling
Error
handling
...
@@ -263,7 +264,3 @@ Note that in the previous example, the first line was output through logging.
...
@@ -263,7 +264,3 @@ Note that in the previous example, the first line was output through logging.
>>>
ZEO
.
ClientStorage
.
ClientStorage
=
ClientStorage_orig
>>>
ZEO
.
ClientStorage
.
ClientStorage
=
ClientStorage_orig
>>>
time
.
time
=
time_orig
>>>
time
.
time
=
time_orig
>>>
time
.
sleep
=
sleep_orig
>>>
time
.
sleep
=
sleep_orig
>>> if oldtz is None:
... del os.environ['
TZ
']
... else:
... os.environ['
TZ
'
]
=
oldtz
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