Ejemplo n.º 1
0
        'ESCHATON',
        'EVENT_VENUE',
        'EVENT_VENUE_ADDRESS',
        'AT_THE_CON',
        'POST_CON',
    ]

    def info(self):
        """
        Returns a list of all available configuration settings.
        """
        output = {field: getattr(c, field) for field in self.fields}
        output['API_VERSION'] = __version__
        return output

    def lookup(self, field):
        """
        Returns the given configuration setting. Takes the setting
        name as a single argument. For a list of available settings,
        call the "config.info" method.
        """
        if field.upper() in self.fields:
            return getattr(c, field.upper())


if c.API_ENABLED:
    register_jsonrpc(AttendeeLookup(), 'attendee')
    register_jsonrpc(JobLookup(), 'shifts')
    register_jsonrpc(DepartmentLookup(), 'dept')
    register_jsonrpc(ConfigLookup(), 'config')
Ejemplo n.º 2
0
            fields, query = _attendee_fields_and_query(full, query)
            attendee = query.first()
            if attendee:
                return attendee.to_dict(fields)
            else:
                raise HTTPError(404, 'Valid barcode, but no attendee found with Badge #{}'.format(badge_num))

    def lookup_badge_number_from_barcode(self, barcode_value):
        """
        Returns a badge number using the barcode value from the given badge.

        Takes the (possibly encrypted) barcode value as a single parameter.
        """
        try:
            result = get_badge_num_from_barcode(barcode_value)
            return {'badge_num': result['badge_num']}
        except Exception as e:
            raise HTTPError(500, "Couldn't look up barcode value: " + str(e))


if c.API_ENABLED:
    register_jsonrpc(AttendeeLookup(), 'attendee')
    register_jsonrpc(JobLookup(), 'shifts')
    register_jsonrpc(DepartmentLookup(), 'dept')
    register_jsonrpc(ConfigLookup(), 'config')
    register_jsonrpc(BarcodeLookup(), 'barcode')
    register_jsonrpc(GuestLookup(), 'guest')
    register_jsonrpc(MivsLookup(), 'mivs')
    register_jsonrpc(HotelLookup(), 'hotel')
    register_jsonrpc(ScheduleLookup(), 'schedule')
Ejemplo n.º 3
0
        with Session() as session:
            query = session.query(Attendee).filter_by(badge_num=badge_num)
            fields, query = _attendee_fields_and_query(full, query)
            attendee = query.first()
            if attendee:
                return attendee.to_dict(fields)
            else:
                raise HTTPError(404, 'Valid barcode, but no attendee found with Badge #{}'.format(badge_num))

    def lookup_badge_number_from_barcode(self, barcode_value):
        """
        Returns a badge number using the barcode value from the given badge.

        Takes the (possibly encrypted) barcode value as a single parameter.
        """
        try:
            result = get_badge_num_from_barcode(barcode_value)
            return {'badge_num': result['badge_num']}
        except Exception as e:
            raise HTTPError(500, "Couldn't look up barcode value: " + str(e))


if c.API_ENABLED:
    register_jsonrpc(AttendeeLookup(), 'attendee')
    register_jsonrpc(JobLookup(), 'shifts')
    register_jsonrpc(DepartmentLookup(), 'dept')
    register_jsonrpc(ConfigLookup(), 'config')
    register_jsonrpc(BarcodeLookup(), 'barcode')
    register_jsonrpc(GuestLookup(), 'guest')
    register_jsonrpc(MivsLookup(), 'mivs')
Ejemplo n.º 4
0
            # note: a descrypted barcode can yield to a valid badge#, but an attendee may not have that badge#

            query = session.query(Attendee).filter_by(badge_num=badge_num)
            fields, query = _attendee_fields_and_query(full, query)
            attendee = query.first()
            if attendee:
                return attendee.to_dict(fields)
            else:
                return {
                    'error':
                    'Valid barcode, but no attendee found with Badge #{}'.
                    format(badge_num)
                }

    def lookup_badge_number_from_barcode(self, barcode_value):
        """
        Returns a badge number using the barcode value from the given badge.

        Takes the (possibly encrypted) barcode value as a single parameter.
        """
        with Session() as session:
            try:
                result = get_badge_num_from_barcode(barcode_value)
                return {'badge_num': result['badge_num']}
            except Exception as e:
                return {'error': "Couldn't look up barcode value: " + str(e)}


register_jsonrpc(BarcodeLookup(), 'barcode')