Esempio n. 1
0
    def post(self, **kw):
        data = Bunch(kw)

        record = EVECredential(data.key, data.code, owner=user.id)
        record.save()

        # If record is a character key:
        #   Create character owned by user.id

        if request.is_xhr:
            return 'json:', {
                'success': True,
                'identifier': str(record.id),
                'key': record.key,
                'code': record.code
            }

        raise HTTPFound(location='/key/')
Esempio n. 2
0
    def post(self, **kw):
        data = Bunch(kw)

        record = EVECredential(data.key, data.code, owner=user.id)
        try:
            record.save()
            record.importChars()
            if request.is_xhr:
                return 'json:', {
                    'success': True,
                    'identifier': str(record.id),
                    'key': record.key,
                    'code': record.code
                }
        except ValidationError:
            if request.is_xhr:
                return 'json:', {
                    'success':
                    False,
                    'message':
                    'Validation error for Eve Credential: One or more fields are incorrect or missing'
                }

        raise HTTPFound(location='/key/')