Skip to content
This repository has been archived by the owner on Dec 18, 2020. It is now read-only.

Commit

Permalink
More possibilities for subclassing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jukart committed Sep 17, 2006
1 parent 8592d61 commit 867a3ae
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/z3c/sampledata/generator/principals.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ def generate(self, context, param={}, dataSource=[], seed=None):
if login in self.logins:
# ignore duplicate principals
continue
self._createPrincipal(info)
self._createPrincipal(context, info)
numCreated+=1

if ( self.minPrincipals is not None
and numCreated<self.minPrincipals):
for i in range(self.minPrincipals-numCreated):
info = ['login%i'%i,'name%i'%i,'%i'%i]
self._createPrincipal(info)
info = self._createDummyPrincipalInfo(context, i)
self._createPrincipal(context, info)

hooks.setSite(originalSite)

Expand All @@ -145,7 +145,7 @@ def _getPAU(self, sm, param):
return pau


def _createPrincipal(self, info):
def _createPrincipal(self, site, info):
login = unicode(info[0])
self.logins.append(login)
if login in self.pau['members']:
Expand All @@ -161,3 +161,6 @@ def _createPrincipal(self, info):
zope.lifecycleevent.ObjectCreatedEvent(principal))
self.pau['members'][login] = principal

def _createDummyPrincipalInfo(self, site, i):
return ['login%i'%i, 'name%i'%i, '%i'%i]

0 comments on commit 867a3ae

Please sign in to comment.