Source (Text):
import random
from DateTime import DateTime
target=getattr(context, 'anotehrTest')
types=[objTypeInfo.getId() for objTypeInfo in context.portal_url.getPortalObject().allowedContentTypes()]
for x in range(50):
random_id = str(DateTime().millis())+ str(random.randint(0,100000))
random_type = types[random.randint(0, len(types)-1)]
target.invokeFactory(type_name=random_type, id=random_id)
o = getattr(target, random_id)
o.setTitle(random_id +'s title')
return 'fin'
|