ApplicationRunner 'make' argument

18 views
Skip to first unread message

Greg Fausak

unread,
Sep 14, 2014, 8:37:47 PM9/14/14
to autob...@googlegroups.com
ApplicationRunner's run method takes as its argument the class that creates an instance of ApplicationSession.  Would it make sense to be abler to pass an already instantiated class?  I make a couple of trivial changes to a copy of ApplicationSession:

      ## factory for use ApplicationSession
      def create():
         cfg = ComponentConfig(self.realm, self.extra)
         try:
            if inspect.isclass(make):
               session = make(cfg)
            else:
               session = make


Which allows me to call the run method with a class I've already started.  Is this a bad idea?

-g

Tobias Oberstein

unread,
Sep 15, 2014, 1:25:30 PM9/15/14
to autob...@googlegroups.com
Am 15.09.2014 02:37, schrieb Greg Fausak:
> ApplicationRunner's run method takes as its argument the class that
> creates an instance of ApplicationSession. Would it make sense to be
> abler to pass an already instantiated class? I make a couple of trivial
> changes to a copy of ApplicationSession:

You can just do

ApplicationRunner.run(make = lambda _: session)

where session is your precreated session object.


>
> ## factory for use ApplicationSession
> def create():
> cfg = ComponentConfig(self.realm, self.extra)
> try:
> if inspect.isclass(make):
> session = make(cfg)
> else:
> session = make
>
>
> Which allows me to call the run method with a class I've already
> started. Is this a bad idea?
>
> -g
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/380a6ef7-1a99-4959-8f62-9f64e350449c%40googlegroups.com
> <https://groups.google.com/d/msgid/autobahnws/380a6ef7-1a99-4959-8f62-9f64e350449c%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Greg Fausak

unread,
Sep 15, 2014, 1:36:21 PM9/15/14
to autob...@googlegroups.com
hadn't thought of that :-)

thanks!

-g


On Mon, Sep 15, 2014 at 12:25 PM, Tobias Oberstein <tobias.o...@gmail.com> wrote:
Am 15.09.2014 02:37, schrieb Greg Fausak:
ApplicationRunner's run method takes as its argument the class that
creates an instance of ApplicationSession.  Would it make sense to be
abler to pass an already instantiated class?  I make a couple of trivial
changes to a copy of ApplicationSession:

You can just do

ApplicationRunner.run(make = lambda _: session)

where session is your precreated session object.



       ## factory for use ApplicationSession
       def create():
          cfg = ComponentConfig(self.realm, self.extra)
          try:
             if inspect.isclass(make):
                session = make(cfg)
             else:
                session = make


Which allows me to call the run method with a class I've already
started.  Is this a bad idea?

-g

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send

To post to this group, send email to autob...@googlegroups.com

--
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/H6YUkIGrg48/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autobahnws+unsubscribe@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/54172108.9080309%40gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Greg Fausak
lgfa...@gmail.com
Reply all
Reply to author
Forward
0 new messages