Skip to content

Commit

Permalink
Deployed 29c2616 with MkDocs version: 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Oct 24, 2024
1 parent 7b17634 commit 39d4052
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 68 deletions.
54 changes: 17 additions & 37 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@



<link rel="icon" href="/ckanext-popo/img/favicon.ico">
<link rel="icon" href="/ckanext-event-audit/img/favicon.ico">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">



<title>ckanext-popo</title>
<title>ckanext-event-audit</title>



<link rel="stylesheet" href="/ckanext-popo/assets/stylesheets/main.0253249f.min.css">
<link rel="stylesheet" href="/ckanext-event-audit/assets/stylesheets/main.0253249f.min.css">


<link rel="stylesheet" href="/ckanext-popo/assets/stylesheets/palette.06af60db.min.css">
<link rel="stylesheet" href="/ckanext-event-audit/assets/stylesheets/palette.06af60db.min.css">



Expand All @@ -42,9 +42,9 @@



<link rel="stylesheet" href="/ckanext-popo/assets/_mkdocstrings.css">
<link rel="stylesheet" href="/ckanext-event-audit/assets/_mkdocstrings.css">

<script>__md_scope=new URL("/ckanext-popo/",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<script>__md_scope=new URL("/ckanext-event-audit/",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>



Expand Down Expand Up @@ -81,9 +81,9 @@

<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="/ckanext-popo/." title="ckanext-popo" class="md-header__button md-logo" aria-label="ckanext-popo" data-md-component="logo">
<a href="/ckanext-event-audit/." title="ckanext-event-audit" class="md-header__button md-logo" aria-label="ckanext-event-audit" data-md-component="logo">

<img src="/ckanext-popo/img/logo.png" alt="logo">
<img src="/ckanext-event-audit/img/logo.png" alt="logo">

</a>
<label class="md-header__button md-icon" for="__drawer">
Expand All @@ -94,7 +94,7 @@
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
ckanext-popo
ckanext-event-audit
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
Expand Down Expand Up @@ -187,7 +187,7 @@


<div class="md-header__source">
<a href="https://github.com//ckanext-popo" title="Go to repository" class="md-source" data-md-component="source">
<a href="https://github.com//ckanext-event-audit" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
Expand Down Expand Up @@ -223,16 +223,16 @@

<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="/ckanext-popo/." title="ckanext-popo" class="md-nav__button md-logo" aria-label="ckanext-popo" data-md-component="logo">
<a href="/ckanext-event-audit/." title="ckanext-event-audit" class="md-nav__button md-logo" aria-label="ckanext-event-audit" data-md-component="logo">

<img src="/ckanext-popo/img/logo.png" alt="logo">
<img src="/ckanext-event-audit/img/logo.png" alt="logo">

</a>
ckanext-popo
ckanext-event-audit
</label>

<div class="md-nav__source">
<a href="https://github.com//ckanext-popo" title="Go to repository" class="md-source" data-md-component="source">
<a href="https://github.com//ckanext-event-audit" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
Expand All @@ -252,7 +252,7 @@


<li class="md-nav__item">
<a href="/ckanext-popo/." class="md-nav__link">
<a href="/ckanext-event-audit/." class="md-nav__link">


<span class="md-ellipsis">
Expand All @@ -265,26 +265,6 @@









<li class="md-nav__item">
<a href="/ckanext-popo/hui.md" class="md-nav__link">


<span class="md-ellipsis">
None
</span>


</a>
</li>



</ul>
</nav>
</div>
Expand Down Expand Up @@ -358,10 +338,10 @@ <h1>404 - Not found</h1>
<div class="md-progress" data-md-component="progress" role="progressbar"></div>


<script id="__config" type="application/json">{"base": "/ckanext-popo/", "features": ["navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.footer", "navigation.indexes", "navigation.top", "content.code.copy", "content.code.select", "content.code.annotate"], "search": "/ckanext-popo/assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script id="__config" type="application/json">{"base": "/ckanext-event-audit/", "features": ["navigation.instant", "navigation.instant.prefetch", "navigation.instant.progress", "navigation.footer", "navigation.indexes", "navigation.top", "content.code.copy", "content.code.select", "content.code.annotate"], "search": "/ckanext-event-audit/assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>


<script src="/ckanext-popo/assets/javascripts/bundle.83f73b43.min.js"></script>
<script src="/ckanext-event-audit/assets/javascripts/bundle.83f73b43.min.js"></script>


</body>
Expand Down
147 changes: 118 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@



<link rel="canonical" href="https://.github.io/ckanext-popo/">
<link rel="canonical" href="https://.github.io/ckanext-event-audit/">



Expand All @@ -18,7 +18,7 @@



<title>ckanext-popo</title>
<title>ckanext-event-audit</title>



Expand Down Expand Up @@ -88,7 +88,7 @@

<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="." title="ckanext-popo" class="md-header__button md-logo" aria-label="ckanext-popo" data-md-component="logo">
<a href="." title="ckanext-event-audit" class="md-header__button md-logo" aria-label="ckanext-event-audit" data-md-component="logo">

<img src="img/logo.png" alt="logo">

Expand All @@ -101,7 +101,7 @@
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
ckanext-popo
ckanext-event-audit
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
Expand Down Expand Up @@ -194,7 +194,7 @@


<div class="md-header__source">
<a href="https://github.com//ckanext-popo" title="Go to repository" class="md-source" data-md-component="source">
<a href="https://github.com//ckanext-event-audit" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
Expand Down Expand Up @@ -230,16 +230,16 @@

<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="." title="ckanext-popo" class="md-nav__button md-logo" aria-label="ckanext-popo" data-md-component="logo">
<a href="." title="ckanext-event-audit" class="md-nav__button md-logo" aria-label="ckanext-event-audit" data-md-component="logo">

<img src="img/logo.png" alt="logo">

</a>
ckanext-popo
ckanext-event-audit
</label>

<div class="md-nav__source">
<a href="https://github.com//ckanext-popo" title="Go to repository" class="md-source" data-md-component="source">
<a href="https://github.com//ckanext-event-audit" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
Expand Down Expand Up @@ -311,6 +311,39 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#register-new-repositories" class="md-nav__link">
<span class="md-ellipsis">
Register new repositories
</span>
</a>

<nav class="md-nav" aria-label="Register new repositories">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#defining-the-repository-class" class="md-nav__link">
<span class="md-ellipsis">
Defining the repository class
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#registering-the-repository" class="md-nav__link">
<span class="md-ellipsis">
Registering the repository
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -339,26 +372,6 @@









<li class="md-nav__item">
<a href="hui.md" class="md-nav__link">


<span class="md-ellipsis">
None
</span>


</a>
</li>



</ul>
</nav>
</div>
Expand Down Expand Up @@ -392,6 +405,39 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#register-new-repositories" class="md-nav__link">
<span class="md-ellipsis">
Register new repositories
</span>
</a>

<nav class="md-nav" aria-label="Register new repositories">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#defining-the-repository-class" class="md-nav__link">
<span class="md-ellipsis">
Defining the repository class
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#registering-the-repository" class="md-nav__link">
<span class="md-ellipsis">
Registering the repository
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -433,7 +479,6 @@
<p><a href="https://github.com/DataShades/ckanext-event-audit/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/DataShades/ckanext-event-audit/actions/workflows/test.yml/badge.svg" /></a></p>
<h1 id="ckanext-event-audit">ckanext-event-audit</h1>
<p>This extension will capture and retain a comprehensive record of all changes within a CKAN app. </p>
<p>Read the <a href="https://datashades.github.io/ckanext-event-audit/">documentation</a> for a full user guide.</p>
<h2 id="developer-installation">Developer installation</h2>
<p>To install ckanext-event-audit for development, activate your CKAN virtualenv and
do:</p>
Expand All @@ -442,6 +487,50 @@ <h2 id="developer-installation">Developer installation</h2>
pip install -e .
pip install -r dev-requirements.txt
</code></pre></div>
<h2 id="register-new-repositories">Register new repositories</h2>
<p>There are few repositories available by default, but you can register new repositories to store the events. Think of it as a way to store the events in different databases or services. We don't want to limit the extension to a specific storage. The main idea is to provide a way to store, retrieve, and filter the events.</p>
<p>To register a new repository, you need to define a repository class and register it.</p>
<h3 id="defining-the-repository-class">Defining the repository class</h3>
<p>To register a new repository, you need to define a repository class that inherits from <code>AbstractRepository</code> and implements the following methods: <code>write_event</code>, <code>get_event</code>, and <code>filter_events</code>.</p>
<p>For example:</p>
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">ckanext.event_audit.repositories</span> <span class="kn">import</span> <span class="n">AbstractRepository</span>
<span class="kn">from</span> <span class="nn">ckanext.event_audit</span> <span class="kn">import</span> <span class="n">types</span>


<span class="k">class</span> <span class="nc">MyRepository</span><span class="p">(</span><span class="n">AbstractRepository</span><span class="p">):</span>
<span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;my_repository&quot;</span>

<span class="nd">@classmethod</span>
<span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">cls</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="k">return</span> <span class="s2">&quot;my_repository&quot;</span>

<span class="k">def</span> <span class="nf">write_event</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">:</span> <span class="n">types</span><span class="o">.</span><span class="n">Event</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">types</span><span class="o">.</span><span class="n">WriteStatus</span><span class="p">:</span>
<span class="k">pass</span>

<span class="k">def</span> <span class="nf">get_event</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event_id</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">types</span><span class="o">.</span><span class="n">Event</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">pass</span>

<span class="k">def</span> <span class="nf">filter_events</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filters</span><span class="p">:</span> <span class="n">types</span><span class="o">.</span><span class="n">Filters</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">[</span><span class="n">types</span><span class="o">.</span><span class="n">Event</span><span class="p">]:</span>
<span class="k">pass</span>
</code></pre></div>
<p>See the existing repositories as examples (<code>ckanext/event_audit/repositories/</code>).</p>
<h3 id="registering-the-repository">Registering the repository</h3>
<p>To register the new repository, you need to use a IEventAudit interface and the <code>register_repository</code> method.</p>
<p>For example:</p>
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">ckanext.event_audit.interfaces</span> <span class="kn">import</span> <span class="n">IEventAudit</span>
<span class="kn">from</span> <span class="nn">ckanext.your_extension.repositories</span> <span class="kn">import</span> <span class="n">MyRepository</span>

<span class="k">class</span> <span class="nc">MyRepositoryPlugin</span><span class="p">(</span><span class="n">plugins</span><span class="o">.</span><span class="n">SingletonPlugin</span><span class="p">):</span>
<span class="o">...</span>
<span class="n">plugins</span><span class="o">.</span><span class="n">implements</span><span class="p">(</span><span class="n">IEventAudit</span><span class="p">,</span> <span class="n">inherit</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="c1"># IEventAudit</span>

<span class="k">def</span> <span class="nf">register_repository</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">type</span><span class="p">[</span><span class="n">AbstractRepository</span><span class="p">]]:</span>
<span class="k">return</span> <span class="p">{</span>
<span class="n">MyRepository</span><span class="o">.</span><span class="n">get_name</span><span class="p">():</span> <span class="n">MyRepository</span><span class="p">,</span>
<span class="p">}</span>
</code></pre></div>
<h2 id="tests">Tests</h2>
<p>To run the tests, do:</p>
<div class="highlight"><pre><span></span><code>pytest --ckan-ini=test.ini
Expand Down
Loading

0 comments on commit 39d4052

Please sign in to comment.