Hi, as part of making my application ready for prime time, I'm looking for solutions / suggestions to a few problems. My goal is to be able to launch the application using twistd <appname> --some-param and not have to know the path to the app.tap file and be able to mix normal twistd commandline options and extra application specific options. Does anyone have an example of a Nevow application running as a plugin? [1] Is the document referenced above using the new plugin system or the old one? (twisted.plugins vs twisted.python.plugin) I have found some nuts and bolts, but I am not too sure on how they fit together. As I've understood it, if I got a package myapp that contains the modules for the application, then there should be a file inside this directory called plugins.tml that defines the twisted plugin. This file contains a method: register('myapp', 'myapp.tap', description='My webapp', type='tap', tapname='myapp') then I can run "twisted myapp" to run this class. I would expect there to be an extra interface to do the actual creation of services. As I've understood it, that is the role of the function makeService(config) function that should be placed in myapp/tap.py. Is this correct or very wrong? What is the correct way to do this? What is missing? I tried to find the interface for the register function, but I didn't find it. Please give me some pointers or an example of how to do this. As you can see, I think I understand 20% of plugins - but am missing the other 80. I've tried subclassing the Options class to be able to add my own configuration options. When I do this and try to start the application using twistd -oy app.tap, it bombs out because the normal twistd commandline options are not included. What am I doing wrong? class VdOptions(usage.Options): optParameters = [ ['config', 'c', '/etc/app.ini'], ] cli = VdOptions() try: cli.parseOptions() # When given no argument, parses sys.argv[1:] except usage.UsageError, errortext: print '%s: %s' % (sys.argv[0], errortext) print '%s: Try --help for usage details.' % (sys.argv[0]) sys.exit(1) Links: 1.http://twistedmatrix.com/projects/core/documentation/howto/tutorial/configur... Thanks a lot for any input on this. Kind regards, Tarjei
On 11:07 am, tarjei@nu.no wrote:
Hi, as part of making my application ready for prime time, I'm looking for solutions / suggestions to a few problems.
My goal is to be able to launch the application using twistd <appname> --some-param and not have to know the path to the app.tap file and be able to mix normal twistd commandline options and extra application specific options.
Does anyone have an example of a Nevow application running as a plugin? [1]
http://divmod.org/trac/browser/trunk/Nevow/twisted/plugins/nevow_widget.py http://divmod.org/trac/browser/trunk/Nevow/nevow/_widget_plugin.py This could stand to be improved. In particular it would be good if it instantiated a new page/widget each time rather than using one that can only be rendered once. But it should be a fairly concise example of the basics.
Is the document referenced above using the new plugin system or the old one? (twisted.plugins vs twisted.python.plugin)
Assuming you mean http://twistedmatrix.com/projects/core/documentation/howto/tutorial/configur... "plugins.tml" is a dead giveaway that it's the bad, old one. That document should probably just be deleted. The new, good plugin system is documented here: http://twistedmatrix.com/projects/core/documentation/howto/plugin.html and here: http://twistedmatrix.com/projects/core/documentation/howto/tap.html Good luck :).
participants (2)
-
glyph@divmod.com
-
tarjei