Skip to content

Commit

Permalink
Deploying to gh-pages from @ 9064c5f 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbauer committed Jul 22, 2024
1 parent f18f313 commit 9767453
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 33 deletions.
14 changes: 7 additions & 7 deletions _modules/api/admin/controller.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,16 @@ <h1>Source code for api.admin.controller</h1><div class="highlight"><pre>
<span class="n">redirect_url</span> <span class="o">=</span> <span class="n">flask</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">url</span>

<span class="k">if</span> <span class="p">(</span><span class="n">collection</span><span class="p">):</span>
<span class="n">quoted_collection</span> <span class="o">=</span> <span class="n">urllib</span><span class="o">.</span><span class="n">parse</span><span class="o">.</span><span class="n">quote</span><span class="p">(</span><span class="n">collection</span><span class="p">)</span>
<span class="n">redirect_url</span> <span class="o">=</span> <span class="n">redirect_url</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span>
<span class="n">quoted_collection</span><span class="p">,</span>
<span class="n">quoted_collection</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">%2F</span><span class="s2">&quot;</span><span class="p">))</span>
<span class="n">collection</span><span class="p">,</span>
<span class="n">urllib</span><span class="o">.</span><span class="n">parse</span><span class="o">.</span><span class="n">quote_plus</span><span class="p">(</span><span class="n">collection</span><span class="p">)</span>
<span class="p">)</span>

<span class="k">if</span> <span class="p">(</span><span class="n">book</span><span class="p">):</span>
<span class="n">quoted_book</span> <span class="o">=</span> <span class="n">urllib</span><span class="o">.</span><span class="n">parse</span><span class="o">.</span><span class="n">quote</span><span class="p">(</span><span class="n">book</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">book</span><span class="p">):</span>
<span class="n">redirect_url</span> <span class="o">=</span> <span class="n">redirect_url</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span>
<span class="n">quoted_book</span><span class="p">,</span>
<span class="n">quoted_book</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">%2F</span><span class="s2">&quot;</span><span class="p">))</span>
<span class="n">book</span><span class="p">,</span>
<span class="n">urllib</span><span class="o">.</span><span class="n">parse</span><span class="o">.</span><span class="n">quote_plus</span><span class="p">(</span><span class="n">book</span><span class="p">)</span>
<span class="p">)</span>

<span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">url_for</span><span class="p">(</span><span class="s1">&#39;admin_sign_in&#39;</span><span class="p">,</span> <span class="n">redirect</span><span class="o">=</span><span class="n">redirect_url</span><span class="p">))</span>

Expand Down
9 changes: 7 additions & 2 deletions _modules/api/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ <h1>Source code for api.app</h1><div class="highlight"><pre>
<span class="n">Flask</span><span class="p">,</span>
<span class="n">Response</span><span class="p">,</span>
<span class="n">redirect</span><span class="p">,</span>
<span class="n">request</span>
<span class="p">)</span>
<span class="kn">from</span> <span class="nn">flask_swagger_ui</span> <span class="kn">import</span> <span class="n">get_swaggerui_blueprint</span>
<span class="kn">from</span> <span class="nn">flask_sqlalchemy_session</span> <span class="kn">import</span> <span class="n">flask_scoped_session</span>
<span class="kn">from</span> <span class="nn">.flask_sqlalchemy_session</span> <span class="kn">import</span> <span class="n">flask_scoped_session</span>
<span class="kn">from</span> <span class="nn">.config</span> <span class="kn">import</span> <span class="n">Configuration</span>
<span class="kn">from</span> <span class="nn">core.model</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">ConfigurationSetting</span><span class="p">,</span>
Expand All @@ -72,12 +73,16 @@ <h1>Source code for api.app</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">flask_babel</span> <span class="kn">import</span> <span class="n">Babel</span>


<div class="viewcode-block" id="get_locale"><a class="viewcode-back" href="../../api.html#api.app.get_locale">[docs]</a><span class="k">def</span> <span class="nf">get_locale</span><span class="p">():</span>
<span class="n">languages</span> <span class="o">=</span> <span class="n">Configuration</span><span class="o">.</span><span class="n">localization_languages</span><span class="p">()</span>
<span class="k">return</span> <span class="n">request</span><span class="o">.</span><span class="n">accept_languages</span><span class="o">.</span><span class="n">best_match</span><span class="p">(</span><span class="n">languages</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;en&quot;</span><span class="p">)</span></div>

<span class="n">app</span> <span class="o">=</span> <span class="n">Flask</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">_db</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">app</span><span class="o">.</span><span class="n">static_resources_dir</span> <span class="o">=</span> <span class="n">Configuration</span><span class="o">.</span><span class="n">static_resources_dir</span><span class="p">()</span>
<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s1">&#39;BABEL_DEFAULT_LOCALE&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">LanguageCodes</span><span class="o">.</span><span class="n">three_to_two</span><span class="p">[</span><span class="n">Configuration</span><span class="o">.</span><span class="n">localization_languages</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span>
<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s1">&#39;BABEL_TRANSLATION_DIRECTORIES&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;../translations&quot;</span>
<span class="n">babel</span> <span class="o">=</span> <span class="n">Babel</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
<span class="n">babel</span> <span class="o">=</span> <span class="n">Babel</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">locale_selector</span><span class="o">=</span><span class="n">get_locale</span><span class="p">)</span>

<span class="n">swaggerui_print</span> <span class="o">=</span> <span class="n">get_swaggerui_blueprint</span><span class="p">(</span>
<span class="s1">&#39;/apidocs_admin&#39;</span><span class="p">,</span> <span class="s1">&#39;/admin_docs&#39;</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="o">=</span><span class="s1">&#39;apmin_api&#39;</span>
Expand Down
8 changes: 4 additions & 4 deletions _modules/api/authenticator.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h1>Source code for api.authenticator</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">sqlalchemy.ext.hybrid</span> <span class="kn">import</span> <span class="n">hybrid_property</span>
<span class="kn">from</span> <span class="nn">sqlalchemy.orm.exc</span> <span class="kn">import</span> <span class="n">NoResultFound</span>
<span class="kn">from</span> <span class="nn">sqlalchemy.sql.expression</span> <span class="kn">import</span> <span class="n">or_</span>
<span class="kn">from</span> <span class="nn">werkzeug.datastructures</span> <span class="kn">import</span> <span class="n">Headers</span>
<span class="kn">from</span> <span class="nn">werkzeug.datastructures</span> <span class="kn">import</span> <span class="n">auth</span><span class="p">,</span> <span class="n">Headers</span>

<span class="kn">from</span> <span class="nn">api.util.short_client_token</span> <span class="kn">import</span> <span class="n">ShortClientTokenUtility</span>
<span class="kn">from</span> <span class="nn">api.annotations</span> <span class="kn">import</span> <span class="n">AnnotationWriter</span>
Expand Down Expand Up @@ -869,7 +869,7 @@ <h1>Source code for api.authenticator</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">basic_auth_provider</span>
<span class="ow">and</span> <span class="p">(</span>
<span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="nb">dict</span><span class="p">)</span> <span class="ow">and</span> <span class="s1">&#39;username&#39;</span> <span class="ow">in</span> <span class="n">header</span><span class="p">)</span>
<span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="p">(</span><span class="nb">dict</span><span class="p">,</span> <span class="n">auth</span><span class="o">.</span><span class="n">Authorization</span><span class="p">))</span> <span class="ow">and</span> <span class="s1">&#39;username&#39;</span> <span class="ow">in</span> <span class="n">header</span><span class="p">)</span>
<span class="ow">or</span> <span class="n">provider_name</span> <span class="o">==</span> <span class="n">BasicAuthenticationProvider</span><span class="o">.</span><span class="n">BEARER_TOKEN_PROVIDER_NAME</span>
<span class="p">)</span>
<span class="p">):</span>
Expand Down Expand Up @@ -1990,7 +1990,7 @@ <h1>Source code for api.authenticator</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">credentials</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_authenticate_from_token</span><span class="p">(</span><span class="n">_db</span><span class="p">,</span> <span class="n">credentials</span><span class="p">)</span>

<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">credentials</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">credentials</span><span class="p">,</span> <span class="p">(</span><span class="nb">dict</span><span class="p">,</span> <span class="n">auth</span><span class="o">.</span><span class="n">Authorization</span><span class="p">)):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_authenticate_from_credentials</span><span class="p">(</span><span class="n">_db</span><span class="p">,</span> <span class="n">credentials</span><span class="p">)</span></div>

<span class="k">def</span> <span class="nf">_authenticate_from_token</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_db</span><span class="p">,</span> <span class="n">credentials</span><span class="p">):</span>
Expand Down Expand Up @@ -2143,7 +2143,7 @@ <h1>Source code for api.authenticator</h1><div class="highlight"><pre>

<span class="sd"> :param header: A dictionary with keys `username` and `password`.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="p">(</span><span class="nb">dict</span><span class="p">,</span> <span class="n">auth</span><span class="o">.</span><span class="n">Authorization</span><span class="p">)):</span>
<span class="k">return</span> <span class="kc">None</span>
<span class="k">return</span> <span class="n">header</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;password&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span></div>

Expand Down
4 changes: 2 additions & 2 deletions _modules/core/util.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1>Source code for core.util</h1><div class="highlight"><pre>
<span class="kn">import</span> <span class="nn">string</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">Counter</span>

<span class="kn">import</span> <span class="nn">flask_sqlalchemy_session</span>
<span class="kn">import</span> <span class="nn">api.flask_sqlalchemy_session</span>
<span class="kn">import</span> <span class="nn">sqlalchemy</span>
<span class="kn">from</span> <span class="nn">money</span> <span class="kn">import</span> <span class="n">Money</span>
<span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">distinct</span><span class="p">,</span> <span class="n">select</span>
Expand Down Expand Up @@ -577,7 +577,7 @@ <h1>Source code for core.util</h1><div class="highlight"><pre>
<span class="sd"> :return: Boolean value indicating whether the value is a valid SQLAlchemy session or not</span>
<span class="sd"> :rtype: bool</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="n">sqlalchemy</span><span class="o">.</span><span class="n">orm</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">Session</span><span class="p">,</span> <span class="n">flask_sqlalchemy_session</span><span class="o">.</span><span class="n">flask_scoped_session</span><span class="p">))</span></div>
<span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="n">sqlalchemy</span><span class="o">.</span><span class="n">orm</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">Session</span><span class="p">,</span> <span class="n">api</span><span class="o">.</span><span class="n">flask_sqlalchemy_session</span><span class="o">.</span><span class="n">flask_scoped_session</span><span class="p">))</span></div>


<div class="viewcode-block" id="first_or_default"><a class="viewcode-back" href="../../core.util.html#core.util.first_or_default">[docs]</a><span class="k">def</span> <span class="nf">first_or_default</span><span class="p">(</span><span class="n">collection</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
Expand Down
Loading

0 comments on commit 9767453

Please sign in to comment.