1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """Wizard plugin for the cortado http plug
23 """
24
25 from zope.interface import implements
26
27 import gtk
28 import os
29
30 from flumotion.admin.assistant.interfaces import IHTTPServerPlugin
31 from flumotion.admin.assistant.models import Plug
32 from flumotion.common import messages
33 from flumotion.common.i18n import N_, gettexter
34 from flumotion.ui.fileselector import FileSelectorDialog
35 from flumotion.ui.plugarea import WizardPlugLine
36
37 __version__ = "$Rev$"
38 T_ = gettexter()
39
40
42 """I am a model representing the configuration file for a
43 Request Logger plug.
44 """
45 plugType = "requestlogger-file"
46
51
57
58
102
105
107 self.wizard.waitForTask('ondemand check')
108
109 worker = self.model.component.worker
110 directory = os.path.dirname(self.logfile.get_text())
111
112 def importError(failure):
113 failure.trap(ImportError)
114 self.info('could not import twisted-web')
115 message = messages.Warning(T_(N_(
116 "Worker '%s' cannot import module '%s'."),
117 worker, 'twisted.web'))
118 message.add(T_(N_("\nThis module is part of the '%s'."),
119 'Twisted Project'))
120 message.add(T_(N_("\nThe project's homepage is %s"),
121 'http://www.twistedmatrix.com/'))
122 message.id = 'module-twisted-web'
123 self.wizard.add_msg(message)
124 self.wizard.taskFinished(True)
125 return False
126
127 def checkPathFinished(pathExists):
128 if not pathExists:
129 message = messages.Warning(T_(N_(
130 "Directory '%s' does not exist, "
131 "or is not readable on worker '%s'.")
132 % (directory, worker)))
133 message.id = 'log-path-check'
134 self.wizard.add_msg(message)
135 self.wizard.taskFinished(True)
136 return False
137 else:
138 self.wizard.clear_msg('log-path-check')
139 self.wizard.taskFinished(False)
140 return True
141
142 self.wizard.taskFinished()
143
144 def checkPath(unused):
145 d = self.wizard.runInWorker(
146 worker, 'flumotion.worker.checks.check',
147 'checkDirectory', directory)
148 d.addCallback(checkPathFinished)
149 return d
150
151 d = self.wizard.checkImport(worker, 'twisted.web')
152 d.addCallback(checkPath)
153 d.addErrback(importError)
154 return d
155
156
169
170
172 """I am a model representing the configuration file for the
173 Force download plug.
174 """
175 plugType = "requestmodifier-forcedownload"
176
182
188
189
191
192 - def __init__(self, wizard, model, description):
197
198
199
202
203
217