@@ -32,7 +32,6 @@ def __init__(self, person, minimum_change, batch):
32
32
self .batch = batch
33
33
self .person = person
34
34
self .photo = Photo .get (id = self .person .current_photo_id )
35
- self .reply = None
36
35
self .minimum_change = minimum_change
37
36
self .skipped = False
38
37
self .aborted = False
@@ -148,6 +147,7 @@ def task(self, image):
148
147
while limit > 0 and not soup .find_all (['h1' , 'h2' , 'h3' , 'h4' ], text = re .compile (r'\s*Photo Upload\s*' )):
149
148
if not soup .form :
150
149
self .error .emit ("Could not find form on registration pages (while looking for photo upload)" )
150
+ return
151
151
soup = yield self .submit_form (soup .form )
152
152
error = soup .find ('script' , text = re .compile (r".*alert\('Error" , re .S | re .I ))
153
153
if error :
@@ -156,15 +156,18 @@ def task(self, image):
156
156
msg = m .group (1 )
157
157
msg = msg .replace (r'\r' , '\r ' ).replace (r'\n' , '\n ' )
158
158
self .error .emit ("Error from eventsforce: %s" % msg )
159
+ return
159
160
else :
160
161
self .error .emit ("Eventsforce generated an error, but it couldn't be recognised. Please try the web interface to see what's going on." )
162
+ return
161
163
limit = limit - 1
162
164
163
165
if limit == 0 :
164
166
#f = open('tmp.html', 'w')
165
167
#f.write(str(soup))
166
168
#f.close()
167
169
self .error .emit ("Failed to find photo upload on registration pages" )
170
+ return
168
171
169
172
self .progress .emit (4 )
170
173
@@ -196,16 +199,16 @@ def task(self, image):
196
199
197
200
soup = yield self .submit_form (soup .form , {'uploadFile' : '1' , 'uploadTempPersonID' : temp_person_id , 'uploadGuestNumber' : guest_number , 'uploadDataID' : data_id })
198
201
self .progress .emit (6 )
199
- soup = yield self .submit_form (soup .form , {}, self .prepare_file_upload ('FileStream' , image ))
202
+ soup = yield self .submit_form (soup .form , {}, file = self .prepare_file_upload ('FileStream' , image ))
200
203
self .progress .emit (7 )
201
204
202
205
for script in soup .find_all ('script' ):
203
206
m = re .match (r'^\s*window\.location=\'(.*)\';' , script .text )
204
207
if m :
205
208
break
206
209
if not m :
207
- #print soup
208
210
self .error .emit ("Could not process photo upload (failed to find javascript refresh)" )
211
+ return
209
212
link = m .group (1 )
210
213
211
214
if re .search (r'File could not be saved' , link ):
@@ -242,17 +245,20 @@ def task(self, image):
242
245
while limit > 0 and not re .search (r'Booking details' , soup .find_all ('h1' )[1 ].text .strip (), re .I ):
243
246
if not soup .form :
244
247
self .error .emit ("Could not find form on registration pages (while looking for final booking details page)" )
245
- soup = yield self .submit_form (soup .form )
248
+ erturn
249
+ soup = yield self .submit_form (soup .form , default_fields = {re .compile ('^radQuestion_111_' ): 'Green Pack' })
246
250
limit = limit - 1
247
251
248
252
if limit == 0 :
249
253
self .error .emit ("Failed to reach end of registration pages after uploading photo" )
254
+ return
250
255
251
256
self .progress .emit (11 )
252
257
253
258
final_proceed_button = soup .find ('input' , type = 'button' , onclick = re .compile (r'gotoReceipt' ))
254
259
if not final_proceed_button :
255
260
self .error .emit ("Could not find final SAVE button" )
261
+ return
256
262
link = self .extract_link_from_silly_button (final_proceed_button )
257
263
soup = yield self .get (link )
258
264
@@ -266,6 +272,7 @@ def task(self, image):
266
272
267
273
if not re .search (r'Booking confirmation' , soup .find_all ('h1' )[1 ].text , re .I ):
268
274
self .error .emit ('Final page after upload did not look right, did something bad happen?' )
275
+ return
269
276
270
277
new_opinion = None
271
278
if self .photo .opinion == 'ok' :
@@ -311,7 +318,6 @@ def __init__(self):
311
318
super (QtCore .QObject , self ).__init__ ()
312
319
313
320
self .tasks = None
314
- self .reply = None
315
321
316
322
@QtCore .pyqtSlot (dict , str , str )
317
323
@catcherror
0 commit comments