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
3641553d
Commit
3641553d
authored
Aug 01, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PEP8
parent
b62b846e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
src/Products/ZCatalog/ProgressHandler.py
src/Products/ZCatalog/ProgressHandler.py
+13
-9
No files found.
src/Products/ZCatalog/ProgressHandler.py
View file @
3641553d
...
...
@@ -11,7 +11,8 @@
#
##############################################################################
import
time
,
sys
import
sys
import
time
from
logging
import
getLogger
from
DateTime.DateTime
import
DateTime
...
...
@@ -20,6 +21,7 @@ from zope.interface import implements
LOG
=
getLogger
(
'ProgressHandler'
)
class
IProgressHandler
(
Interface
):
""" A handler to log progress informations for long running
operations.
...
...
@@ -75,10 +77,12 @@ class StdoutHandler:
if
current
>
0
:
if
current
%
self
.
_steps
==
0
:
seconds_so_far
=
time
.
time
()
-
self
.
_start
seconds_to_go
=
seconds_so_far
/
current
*
(
self
.
_max
-
current
)
seconds_to_go
=
(
seconds_so_far
/
current
*
(
self
.
_max
-
current
))
end
=
DateTime
(
time
.
time
()
+
seconds_to_go
)
self
.
output
(
'%d/%d (%.2f%%) Estimated termination: %s'
%
\
(
current
,
self
.
_max
,
(
100.0
*
current
/
self
.
_max
),
DateTime
(
time
.
time
()
+
seconds_to_go
)
.
strftime
(
'%Y/%m/%d %H:%M:%Sh'
)))
end
.
strftime
(
'%Y/%m/%d %H:%M:%Sh'
)))
def
output
(
self
,
text
):
print
>>
self
.
fp
,
'%s: %s'
%
(
self
.
_ident
,
text
)
...
...
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