From: Adam B. <ada...@gm...> - 2016-07-20 08:12:18
|
Hi Ari It looks like it is a normal object-level method, but you are invoking it statically. You could just get hold of a GroupService object, instead of the class, and call findByName() on that the normal way. You are actually allows to invoke statically in Python, but the method still needs an object to act on, so you have to pass that as the first parameter. It is then received as the parameter self. class A: def a(self): print "a" aobj = A() A.a(aobj) a.a() # same as previous Cheers Adam > 在 20 Jul 2016,3:20 PM,Häyrinen, Ari <ari...@jy...> 写道: > > > Hi, > there is a Java class called "GroupServiceImpl": > > public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements GroupService > > This class has mehod called "findByName": > > @Override > public Group findByName(Context context, String name) throws SQLException { > > > So there are 2 arguments for that method. > > I try to use this method like this (this is DSpace curator task): > > class ConvertOldEmbargo(ScriptedTask): > def init(self, curator, taskName): > self.c = curator > > def performDso(self, dso): > anonymous = GroupService.findByName(self.c.curationContext(), "Anonymous"); > > Jython complains: > TypeError: findByName(): expected 3 args; got 2 > > What is the third argument and how should I deliver it? Did I misunderstood something? > > Any help much appreciated. > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity planning > reports.http://sdm.link/zohodev2dev > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |