Export authentication default forms.
501293
protected function exportForms()
    {
        foreach ($this->forms as $pathIn => $pathOut) {
            if ($this->files->exists($form = app_path('Forms/'.$pathOut)) && ! $this->option('force')) {
                if (! $this->confirm("The [{$pathOut}] form already exists. Do you want to overwrite it?")) {
                    continue;
                }
            }

            $this->files->put(
                $form,
                $this->compileStub($this->files->get(__DIR__.'/stubs/make/forms/'.$pathIn))
            );
        }
    }
815842
def export_action_form_factory(formats):
    
    class _ExportActionForm(ActionForm):
        """
        Action form with export format ChoiceField.
        """
        file_format = forms.ChoiceField(
            label=_('Format'), choices=formats, required=False)
    _ExportActionForm.__name__ = str('ExportActionForm')

    return _ExportActionForm
403149
public function optionForm()
    {
        $fields = [];
        $default = $this->defaultInstallOptions();

        $fields[] = (new BooleanField('site', 'Setup Drupal site options?'))
            ->setDefault(false)
            ->setSubform(function ($subform, $value) use ($default) {
                if ($value === true) {
                    $subform->addFields([
                        (new TextField('name', 'Drupal site name?'))
                            ->setDefault($default['site']['name']),
                        (new TextField('profile', 'Drupal site profile?'))
                            ->setDefault($default['site']['profile']),
                    ]);
                }
            });

        $fields[] = (new BooleanField('account', 'Setup Drupal account options?'))
            ->setDefault(false)
            ->setSubform(function ($subform, $value) use ($default) {
                if ($value === true) {
                    $subform->addFields([
                        (new TextField('mail', 'Account email:'))
                            ->setDefault($default['account']['mail']),
                        (new TextField('name', 'Account username:'))
                            ->setDefault($default['account']['name']),
                        (new TextField('pass', 'Account password:'))
                            ->setHidden(true)
                            ->setDefault($default['account']['pass']),
                    ]);
                }
            });

        return (new Form())
            ->addFields($fields);
    }
747942
def to_header(self):
        """"""
        d = dict(self)
        auth_type = d.pop("__auth_type__", None) or "basic"
        return "%s %s" % (
            auth_type.title(),
            ", ".join(
                [
                    "%s=%s"
                    % (
                        key,
                        quote_header_value(
                            value, allow_token=key not in self._require_quoting
                        ),
                    )
                    for key, value in iteritems(d)
                ]
            ),
        )
436080
def defaults(self):
        """"""
        return dict(
            access_right='open',
            description=self.description,
            license='other-open',
            publication_date=self.release['published_at'][:10],
            related_identifiers=list(self.related_identifiers),
            version=self.version,
            title=self.title,
            upload_type='software',
        )
444907
def export(app, local, no_scrub):
    """"""
    log(header, chevrons=False)
    data.export(str(app), local=local, scrub_pii=(not no_scrub))
348305
def profile_form_factory():
    """"""
    if current_app.config['USERPROFILES_EMAIL_ENABLED']:
        return EmailProfileForm(
            formdata=None,
            username=current_userprofile.username,
            full_name=current_userprofile.full_name,
            email=current_user.email,
            email_repeat=current_user.email,
            prefix='profile', )
    else:
        return ProfileForm(
            formdata=None,
            obj=current_userprofile,
            prefix='profile', )
49860
function exportThemes(req, res, next) {
  var options = req.connectionOptions;

  forms.exportThemes(options, resultHandler(constants.resultTypes.themes, req, next));
}
914282
def process_form(self, instance, field, form, empty_marker=None,
                     emptyReturnsMarker=False):
        

        # selected services
        service_uids = form.get("uids", [])
        # hidden services
        hidden_services = form.get("Hidden", {})

        # get the service objects
        services = map(api.get_object_by_uid, service_uids)
        # get dependencies
        dependencies = map(lambda s: s.getServiceDependencies(), services)
        dependencies = list(itertools.chain.from_iterable(dependencies))
        # Merge dependencies and services
        services = set(services + dependencies)

        as_settings = []
        for service in services:
            service_uid = api.get_uid(service)
            hidden = hidden_services.get(service_uid, "") == "on"
            as_settings.append({"uid": service_uid, "hidden": hidden})

        # set the analysis services settings
        instance.setAnalysisServicesSettings(as_settings)

        return map(api.get_uid, services), {}
1233028
def post(self):
    """"""
    template_values = {
        'back_url': '/showCredentials',
        'back_msg': 'View Credentials',
        'logout_url': users.create_logout_url('/'),
        'user_nickname': users.get_current_user().nickname()
    }
    try:
      UpdateUserCredentials(self.request.get('client_id'),
                            self.request.get('client_secret'),
                            self.request.get('refresh_token'),
                            self.request.get('adwords_manager_cid'),
                            self.request.get('dev_token'))
      self.redirect('/showCredentials')
    except Exception, e:
      template_values['error'] = str(e)
      # Use template to write output to the page.
      path = os.path.join(os.path.dirname(__file__),
                          '../templates/base_template.html')
      self.response.out.write(template.render(path, template_values))
400591
def basic_authentication_ie(title, username, password, options = {})
      default_options = {:textctrl_username => "Edit2",
                         :textctrl_password => "Edit3",
                         :button_ok => 'Button1'
      }

      options = default_options.merge(options)

      title ||= ""      
      if title =~ /^Connect\sto/
        full_title = title
      else
        full_title = "Connect to #{title}"
      end
      require 'rformspec'
      login_win = RFormSpec::Window.new(full_title)
      login_win.send_control_text(options[:textctrl_username], username)
      login_win.send_control_text(options[:textctrl_password], password)
      login_win.click_button("OK")
    end
299445
def clean(self):
        
        raise forms.ValidationError(
            self.error_messages['invalid_login'],
            code='invalid_login',
            params={'username': self.username_field.verbose_name}
        )
724441
public function formExtendFields($form)
    {
        /*
         * Show the username field if it is configured for use
         */
        if (
            UserSettings::get('login_attribute') == UserSettings::LOGIN_USERNAME &&
            array_key_exists('username', $form->getFields())
        ) {
            $form->getField('username')->hidden = false;
        }
    }
1109285
def login(self, request, extra_context=None):
        
        context = {
            'title': _('Log in'),
            'app_path': request.get_full_path(),
        }
        if (REDIRECT_FIELD_NAME not in request.GET and
                REDIRECT_FIELD_NAME not in request.POST):
            context[REDIRECT_FIELD_NAME] = request.get_full_path()
        context.update(extra_context or {})
        defaults = {
            'extra_context': context,
            'current_app': self.name,
            'authentication_form': self.login_form or AdminAuthenticationForm,
            'template_name': self.login_template or 'admin/login.html',
        }
        return login(request, **defaults)
36227
public function exportArchiveAction()
    {
        $params = $this->_processParameters($this->showParameters);

        $this->addSnippets($this->exportSnippets, $params);

        $this->html->h2($this->_('Export respondent archive'));

        //Now show the export form
        $export = $this->loader->getRespondentExport();
        $form   = $export->getForm();
        $div    = $this->html->div(array('id' => 'mainform'));
        $div[]  = $form;

        $request = $this->getRequest();

        $form->populate($request->getParams());

        if ($request->isPost()) {
            $respondent = $this->getRespondent();
            $patients   = array(
                array(
                    'gr2o_id_organization' => $respondent->getOrganizationId(),
                    'gr2o_patient_nr'      => $respondent->getPatientNumber()
                    )
                );
            $export->render($patients, $request->getParam('group'), $request->getParam('format'));
        }
    }
436696
public function initForm()
    {
        

    	$this->form = new tao_helpers_form_xhtml_Form('export');

		$this->form->setDecorators(array(
			'element'			=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div')),
			'group'				=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-group')),
			'error'				=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-error ui-state-error ui-corner-all')),
			'actions-bottom'	=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-toolbar')),
			'actions-top'		=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-toolbar'))
		));

    	$exportElt = tao_helpers_form_FormFactory::getElement('export', 'Free');
		$exportElt->setValue('<a href="#" class="form-submitter btn-success small"><span class="icon-export"></span> ' .__('Export').'</a>');

		$this->form->setActions(array($exportElt), 'bottom');
        
    }
570336
def get_default_credentials(scopes):
    """"""
    credentials, _ = google.auth.default(scopes=scopes)
    return credentials