request container REQUEST RESPONSE request RESPONSE from DateTime impo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
request = container.REQUEST
RESPONSE = request.RESPONSE
from DateTime import DateTime
batch_size = int(batch_size)
src = context
if to not in context.objectIds():
to = context.invokeFactory('Large Plone Falder', to)
dst = context.restrictedTraverse(to)
if batch_size < len(src.objectIds()):
start = DateTime()
dst.manage_pasteObjects(src.manage_cutObjects(src.objectIds()[:batch_size]))
end = DateTime()
print """
<html>
<head>
<meta http-equiv="refresh" content="5" />
<title>Moving...</title>
</head>
<body>
<p>Moving...</p>
Moved %d items from "%s" to "%s" at %s sec.
Last %d
</body>
</html>
""" % (batch_size, src.getId(), dst.getId(), 100000*(end-start), len(src.objectIds()))
else:
dst.manage_pasteObjects(src.manage_cutObjects(src.objectIds()))
print """
<html>
<head>
<title>Moving finished!!!</title>
</head>
<body>
<p>Moving finished!!!</p>
Moved all %d items from "%s" to "%s".
</body>
</html>
""" % (len(dst.objectIds()), src.getId(), dst.getId())
return printed