def _checkParams(self): self._locationName = request.form.get('newLocationName').strip() if not self._locationName: raise FormValuesError(_('Location name may not be empty')) if '/' in self._locationName: raise FormValuesError(_('Location name may not contain slashes')) if Location.find_first(name=self._locationName): raise FormValuesError(_('Location "{0}" already exists').format(self._locationName))
def _process(self): pdf = RegistrantsListToPDF(self._conf, reglist=self.registrations, display=self.export_config['regform_items'], static_items=self.export_config['static_item_ids']) try: data = pdf.getPDFBin() except Exception: if Config.getInstance().getDebug(): raise raise FormValuesError(_("Text too large to generate a PDF with table style. " "Please try again generating with book style.")) return send_file('RegistrantsList.pdf', BytesIO(data), 'PDF')
def _checkParams(self): name = request.view_args.get('locationId') self._location = Location.find_first(name=name) if not self._location: raise IndicoError(_('Unknown Location: {0}').format(name)) self._new_attr = None attr_title = request.form.get('newCustomAttributeName', default='').strip() if attr_title: attr_name = attr_title.replace(' ', '-').lower() if self._location.get_attribute_by_name(attr_name): raise FormValuesError(_('There is already an attribute named: {0}').format(attr_name)) self._new_attr = RoomAttribute(name=attr_name, title=attr_title, type='str', is_required=request.form.get('newCustomAttributeIsRequired') == 'on', is_hidden=request.form.get('newCustomAttributeIsHidden') == 'on')