from DateTime import DateTime request container REQUEST RESPONSE reque

 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
47
from DateTime import DateTime
request = container.REQUEST
RESPONSE = request.RESPONSE
batch_size = int(batch_size)
f = context.restrictedTraverse(src)
d = context.restrictedTraverse(dst)
if src not in d.objectIds():
d.invokeFactory('Large Plone Folder', src)
d = d[src]
if batch_size < len(f.objectIds()):
start = DateTime()
d.manage_pasteObjects(f.manage_cutObjects(f.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, f.getId(), d.getId(), 100000*(end-start), len(f.objectIds()))
else:
d.manage_pasteObjects(f.manage_cutObjects(f.objectIds()))
context.manage_delObjects([src])
print """
<html>
<head>
<title>Moving finished!!!</title>
</head>
<body>
<p>Moving finished!!!</p>
Moved all %d items from "%s" to "%s".
</body>
</html>
""" % (len(d.objectIds()), f.getId(), d.getId())
return printed