File: configuration.rst

package info (click to toggle)
twisted 25.5.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,560 kB
  • sloc: python: 203,171; makefile: 200; sh: 92; javascript: 36; xml: 31
file content (93 lines) | stat: -rw-r--r-- 1,783 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

:LastChangedDate: $LastChangedDate$
:LastChangedRevision: $LastChangedRevision$
:LastChangedBy: $LastChangedBy$

The Evolution of Finger: configuration of the finger service
============================================================






Introduction
------------



This is the eleventh part of the Twisted tutorial :doc:`Twisted from Scratch, or The Evolution of Finger <index>` .




In this part, we make it easier for non-programmers to configure a finger server.
Plugins are discussed further in the :doc:`Twisted Plugin System <../plugin>` howto.
Writing twistd plugins is covered in :doc:`Writing a twistd Plugin <../tap>`, and .tac applications are covered in :doc:`Using the Twisted Application Framework <../application>`.





Plugins
-------



So far, the user had to be somewhat of a programmer to be able to configure
stuff. Maybe we can eliminate even that? Move old code
to ``finger/__init__.py`` and...




Full source code for finger module here:

:download:`finger.py <listings/finger/finger/finger.py>`

.. literalinclude:: listings/finger/finger/finger.py







:download:`tap.py <listings/finger/finger/tap.py>`

.. literalinclude:: listings/finger/finger/tap.py


And register it all:





:download:`finger_tutorial.py <listings/finger/twisted/plugins/finger_tutorial.py>`

.. literalinclude:: listings/finger/twisted/plugins/finger_tutorial.py


Note that the second argument to :py:class:`ServiceMaker <twisted.application.service.ServiceMaker>` ,``finger.tap`` , is a reference to a module
(``finger/tap.py`` ), not to a filename.




And now, the following works





.. code-block:: console


    % sudo twistd -n finger --file=/etc/users --ircnick=fingerbot





For more details about this, see the :doc:`twistd plugin documentation <../tap>` .