Skip to content

Commit cc04e4d

Browse files
committed
small tweaks in blog autogenerated thing
1 parent b4e4a2e commit cc04e4d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

‎blog/2017-09-08-repository-and-unit-of-work-pattern-in-python.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ <h1> Repository and Unit of Work Pattern</h1>
220220
request.</p>
221221
<p>What does a unit of work look like?</p>
222222
<divclass="codehilite"><pre><span></span><code><spanclass="k">class</span><spanclass="nc">SqlAlchemyUnitOfWorkManager</span><spanclass="p">(</span><spanclass="n">UnitOfWorkManager</span><spanclass="p">):</span>
223-
<spanclass="sd">&quot;&quot;&quot;The Unit of work manager returns a new unit of work. </span>
223+
<spanclass="w"></span><spanclass="sd">&quot;&quot;&quot;The Unit of work manager returns a new unit of work. </span>
224224
<spanclass="sd"> Our UOW is backed by a sql alchemy session whose </span>
225225
<spanclass="sd"> lifetime can be scoped to a web request, or a </span>
226226
<spanclass="sd"> long-lived background job.&quot;&quot;&quot;</span>
@@ -232,7 +232,7 @@ <h1> Repository and Unit of Work Pattern</h1>
232232

233233

234234
<spanclass="k">class</span><spanclass="nc">SqlAlchemyUnitOfWork</span><spanclass="p">(</span><spanclass="n">UnitOfWork</span><spanclass="p">):</span>
235-
<spanclass="sd">&quot;&quot;&quot;The unit of work captures the idea of a set of things that</span>
235+
<spanclass="w"></span><spanclass="sd">&quot;&quot;&quot;The unit of work captures the idea of a set of things that</span>
236236
<spanclass="sd"> need to happen together. </span>
237237

238238
<spanclass="sd"> Usually, in a relational database, </span>

‎blog/2017-09-19-why-use-domain-events.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,20 +354,20 @@ <h2>Mapping our requirements to our domain</h2>
354354
<divclass="codehilite"><pre><span></span><code><spanclass="k">class</span><spanclass="nc">MessageBus</span><spanclass="p">:</span>
355355

356356
<spanclass="k">def</span><spanclass="fm">__init__</span><spanclass="p">(</span><spanclass="bp">self</span><spanclass="p">):</span>
357-
<spanclass="sd">&quot;&quot;&quot;Our message bus is just a mapping from message type</span>
357+
<spanclass="w"></span><spanclass="sd">&quot;&quot;&quot;Our message bus is just a mapping from message type</span>
358358
<spanclass="sd"> to a list of handlers&quot;&quot;&quot;</span>
359359
<spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">subscribers</span><spanclass="o">=</span><spanclass="n">defaultdict</span><spanclass="p">(</span><spanclass="nb">list</span><spanclass="p">)</span>
360360

361361
<spanclass="k">def</span><spanclass="nf">handle</span><spanclass="p">(</span><spanclass="bp">self</span><spanclass="p">,</span><spanclass="n">msg</span><spanclass="p">):</span>
362-
<spanclass="sd">&quot;&quot;&quot;The handle method invokes each handler in turn</span>
362+
<spanclass="w"></span><spanclass="sd">&quot;&quot;&quot;The handle method invokes each handler in turn</span>
363363
<spanclass="sd"> with our event&quot;&quot;&quot;</span>
364364
<spanclass="n">msg_name</span><spanclass="o">=</span><spanclass="nb">type</span><spanclass="p">(</span><spanclass="n">msg</span><spanclass="p">)</span><spanclass="o">.</span><spanclass="vm">__name__</span>
365365
<spanclass="n">subscribers</span><spanclass="o">=</span><spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">subscribers</span><spanclass="p">[</span><spanclass="n">msg_name</span><spanclass="p">]</span>
366366
<spanclass="k">for</span><spanclass="n">subscriber</span><spanclass="ow">in</span><spanclass="n">subscribers</span><spanclass="p">:</span>
367367
<spanclass="n">subscriber</span><spanclass="o">.</span><spanclass="n">handle</span><spanclass="p">(</span><spanclass="n">cmd</span><spanclass="p">)</span>
368368

369369
<spanclass="k">def</span><spanclass="nf">subscribe_to</span><spanclass="p">(</span><spanclass="bp">self</span><spanclass="p">,</span><spanclass="n">msg</span><spanclass="p">,</span><spanclass="n">handler</span><spanclass="p">):</span>
370-
<spanclass="sd">&quot;&quot;&quot;Subscribe sets up a new mapping, we make sure not</span>
370+
<spanclass="w"></span><spanclass="sd">&quot;&quot;&quot;Subscribe sets up a new mapping, we make sure not</span>
371371
<spanclass="sd"> to allow more than one handler for a command&quot;&quot;&quot;</span>
372372
<spanclass="n">subscribers</span><spanclass="o">=</span><spanclass="p">[</span><spanclass="n">msg</span><spanclass="o">.</span><spanclass="vm">__name__</span><spanclass="p">]</span>
373373
<spanclass="k">if</span><spanclass="n">msg</span><spanclass="o">.</span><spanclass="n">is_cmd</span><spanclass="ow">and</span><spanclass="nb">len</span><spanclass="p">(</span><spanclass="n">subscribers</span><spanclass="p">)</span><spanclass="o">&gt;</span><spanclass="mi">0</span><spanclass="p">:</span>

‎blog/2019-04-15-inversion-of-control.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ <h2>Removing cycles by inverting control</h2>
111111
<p>There are a few ways to tackle a circular dependency. You may be able to extract a shared dependency into a separate
112112
module, that the other two modules depend on. You may be able to create an extra module that coordinates the two modules,
113113
instead of them calling each other. Or you can use inversion of control.</p>
114-
<p>At the moment, each module calls each other. We can pick one of the calls (let&rsquo;s say <code>A</code>&lsquo;s call to <code>B</code>) and invert
114+
<p>At the moment, each module calls each other. We can pick one of the calls (let&rsquo;s say <code>A</code>&rsquo;s call to <code>B</code>) and invert
115115
control so that <code>A</code> no longer needs to know anything about <code>B</code>. Instead, it exposes a way of plugging into its
116116
behaviour, that <code>B</code> can then exploit. This can be diagrammed like so:</p>
117117
<p><imgsrc="/images/why-di/plugin.png" alt="B plugging into A" /></p>

‎rss.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Simple patterns for building complex apps
88
</description>
99
<link>https://www.cosmicpython.com</link>
10-
<lastBuildDate>Tue, 02 Aug 2022 10:10:54 -0000</lastBuildDate>
10+
<lastBuildDate>Mon, 19 Feb 2024 15:08:06 -0000</lastBuildDate>
1111
<pubDate>Sat, 4 Jan 2020 19:15:54 -0500</pubDate>
1212
<atom:linkhref="https://cosmicpython.com/rss.xml"rel="self"type="application/rss+xml" />
1313

0 commit comments

Comments
(0)