Browse code

"list staffers pdf"

Doug Le Tough authored on 09/05/2018 09:05:01
Showing 1 changed files
... ...
@@ -1063,14 +1063,6 @@ def print_users():
1063 1063
       page = str(request.url_rule)
1064 1064
       menu = get_menu(page)
1065 1065
       staffers = Tetawebapp_users.query.filter(Tetawebapp_users.is_admin==0, Tetawebapp_users.link_id==None).order_by(Tetawebapp_users.name).all()
1066
-      #~ data = render_template('list_users_txt.html', staffers=staffers)
1067
-
1068
-
1069
-      #~ data = [line for line in data.split('\n') if len(line) > 0]
1070
-      #~ data = '\n'.join(data)
1071
-      #~ data = [line for line in data.split('",\n') if len(line) > 0]
1072
-      #~ data = '", '.join(data)
1073
-      #~ ddata = [ast.literal_eval(line) for line in data.split('\n')]
1074 1066
       pdf = cStringIO.StringIO()
1075 1067
       cols_width = 585
1076 1068
       doc = SimpleDocTemplate(pdf, pagesize=A4, rightMargin=3,leftMargin=3, topMargin=3,bottomMargin=3)
... ...
@@ -1137,39 +1129,6 @@ def print_users():
1137 1137
       table.setStyle(TableStyle( [('GRID', (0,0), (-1,-1), 0.25, colors.black),
1138 1138
                                     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]))
1139 1139
       elements.append(table)
1140
-        
1141
-        #~ wday = day[0]
1142
-        #~ day_turns = day[1]
1143
-        #~ cur_role = ''
1144
-        #~ if wday not in ['Mardi', 'Mercredi']:
1145
-          #~ elements.append(PageBreak())
1146
-        #~ elements.append(Paragraph("<b>%s</b>" % wday, styles['day_title']))
1147
-        #~ for turn in day_turns:
1148
-          #~ rows = []
1149
-          #~ role = turn[1]
1150
-          #~ start_time = turn[0].start_time
1151
-          #~ end_time = turn[0].end_time
1152
-          #~ num_slot = turn[0].num_slot
1153
-          #~ role_id = turn[0].role_id
1154
-          #~ turn_id = turn[0].id
1155
-          #~ if role != cur_role:
1156
-            #~ cur_role = role
1157
-            #~ elements.append(Paragraph("<b>%s</b>" % role, styles['role_title']))
1158
-          #~ row = (Paragraph("<b>%s / %s</b>" % (start_time.strftime('%HH%M'), end_time.strftime('%HH%M')), styles['row1']),)
1159
-          #~ for slot in range(0, num_slot):
1160
-            #~ cols_width = [100] + [485/num_slot] * num_slot
1161
-            #~ allocated_slot = []
1162
-            #~ for sslot in staffs:
1163
-              #~ if sslot[0].turn_id == turn_id and sslot[0].slot_num == slot:
1164
-                #~ allocated_slot.append(sslot[0].slot_num)
1165
-                #~ row += (Paragraph(sslot[1], styles['row2']),)
1166
-            #~ if slot not in allocated_slot:
1167
-              #~ row += (Paragraph("&nbsp;", styles['row2']),)
1168
-          #~ rows.append(row)
1169
-          #~ table = Table(rows, colWidths=cols_width, rowHeights=23)
1170
-          #~ table.setStyle(TableStyle( [('GRID', (0,0), (-1,-1), 0.25, colors.black),
1171
-                                      #~ ('ALIGN', (1,1), (-1,-1), 'RIGHT')]))
1172
-          #~ elements.append(table)
1173 1140
       styles.wordWrap = 'CJK'
1174 1141
       doc.build(elements)
1175 1142
       pdf_out = pdf.getvalue()
... ...
@@ -1178,21 +1137,10 @@ def print_users():
1178 1178
       response.headers['Content-Disposition'] = "attachment; filename=feuille_staff_thsf.pdf"
1179 1179
       response.mimetype = 'application/pdf'
1180 1180
       return response
1181
-
1182
-
1183
-
1184
-
1185
-
1186
-
1187
-
1188
-
1189
-
1190
-
1191
-
1192
-      
1193 1181
   # User is not admin
1194 1182
     return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
1195 1183
   except Exception as e:
1184
+    raise e
1196 1185
     # User is not logged in
1197 1186
     return render_template('login_or_register.html', message="%s" % e)
1198 1187