# check for clear text; fake a new exception to notify user
                try:
                    unicode(license_object.payload, 'utf-8')
                except Exception, e:
                    template_args['controller_exception'] = ValueError('Invalid license file submitted')
                    license_object = None
                    
            
            elif formset_pasted_license:
                license_object = License(name=('web_%s.lic' % time.time()), namespace=None, owner=None)
                license_object.payload = formset_pasted_license


            if license_object:
                try:
                    license_object.create()
                    template_args['is_success'] = True

                    # check if server switched groups
                    new_group = Group.all().filter(is_active=True)
                    if new_group:
                        template_args['new_group'] = new_group[0].name

                    # or just assume that the source group can sufficiently
                    # determine if a restart is required
                    if template_args['current_group'] in ['Free','Forwarder','Trial']:
                        template_args['prompt_restart'] = True

                except Exception, e:
                    template_args['controller_exception'] = e
                    logger.exception(e)
Exemple #2
0
                try:
                    unicode(license_object.payload, 'utf-8')
                except Exception, e:
                    template_args['controller_exception'] = ValueError(
                        'Invalid license file submitted')
                    license_object = None

            elif formset_pasted_license:
                license_object = License(name=('web_%s.lic' % time.time()),
                                         namespace=None,
                                         owner=None)
                license_object.payload = formset_pasted_license

            if license_object:
                try:
                    license_object.create()
                    template_args['is_success'] = True

                    # check if server switched groups
                    new_group = Group.all().filter(is_active=True)
                    if new_group:
                        template_args['new_group'] = new_group[0].name

                    # or just assume that the source group can sufficiently
                    # determine if a restart is required
                    if template_args['current_group'] in [
                            'Free', 'Forwarder', 'Trial'
                    ]:
                        template_args['prompt_restart'] = True

                except Exception, e: