platzky 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
platzky/models.py CHANGED
@@ -160,29 +160,32 @@ class Post(BaseModel):
160
160
  slug: URL-friendly unique identifier for the post
161
161
  title: Post title
162
162
  contentInMarkdown: Post content in Markdown format
163
- comments: List of comments on this post
164
163
  excerpt: Short summary or preview of the post
165
- tags: List of tags for categorization
166
- language: Language code for the post content
167
164
  coverImage: Cover image for the post
168
- date: Datetime when the post was published (timezone-aware recommended)
165
+ language: Language code for the post content (defaults to 'en')
166
+ comments: Optional list of comments on this post
167
+ tags: Optional list of tags for categorization
168
+ date: Optional datetime when the post was published (timezone-aware recommended)
169
169
  """
170
170
 
171
171
  author: str
172
172
  slug: str
173
173
  title: str
174
174
  contentInMarkdown: str
175
- comments: list[Comment]
176
175
  excerpt: str
177
- tags: list[str]
178
- language: str
179
- coverImage: Image
180
- date: DateTimeField
176
+ coverImage: Image = Field(default_factory=Image)
177
+ language: str = "en"
178
+ comments: list[Comment] = Field(default_factory=list)
179
+ tags: list[str] = Field(default_factory=list)
180
+ date: DateTimeField | None = None
181
181
 
182
182
  def __lt__(self, other: object) -> bool:
183
183
  """Compare posts by date for sorting.
184
184
 
185
185
  Uses datetime comparison to ensure robust and correct ordering.
186
+ Posts without dates are treated as "less than" dated posts, meaning they
187
+ appear last when using descending sort (reverse=True, newest-first) and
188
+ first when using ascending sort.
186
189
 
187
190
  Args:
188
191
  other: Another Post instance to compare against
@@ -192,6 +195,13 @@ class Post(BaseModel):
192
195
  or NotImplemented if comparing with a non-Post object
193
196
  """
194
197
  if isinstance(other, Post):
198
+ # Posts without dates are sorted last
199
+ if self.date is None and other.date is None:
200
+ return False
201
+ if self.date is None:
202
+ return True # None is "less than" any date (sorted last)
203
+ if other.date is None:
204
+ return False
195
205
  return self.date < other.date
196
206
  return NotImplemented
197
207
 
platzky/seo/seo.py CHANGED
@@ -59,8 +59,9 @@ def create_seo_blueprint(
59
59
  # TODO: Add get_list_of_posts for faster getting just list of it
60
60
  for post in db.get_all_posts(lang):
61
61
  slug = post.slug
62
- datet = post.date.date().isoformat()
63
- url = {"loc": f"{host_base}{blog_prefix}/{slug}", "lastmod": datet}
62
+ url: dict[str, str] = {"loc": f"{host_base}{blog_prefix}/{slug}"}
63
+ if post.date is not None:
64
+ url["lastmod"] = post.date.date().isoformat()
64
65
  dynamic_urls.append(url)
65
66
  return dynamic_urls
66
67
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: platzky
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Not only blog engine
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -21,11 +21,11 @@ platzky/db/mongodb_db.py,sha256=nq07j0NldK014qRL1mF-cvBXQF1LKKTTeWxaZdyzjAs,8595
21
21
  platzky/engine.py,sha256=9Y74nrO4gwr9_CqRTzPs9LtcY2t0fs0XtPyjPiqRlVQ,5573
22
22
  platzky/locale/en/LC_MESSAGES/messages.po,sha256=WaZGlFAegKRq7CSz69dWKic-mKvQFhVvssvExxNmGaU,1400
23
23
  platzky/locale/pl/LC_MESSAGES/messages.po,sha256=sUPxMKDeEOoZ5UIg94rGxZD06YVWiAMWIby2XE51Hrc,1624
24
- platzky/models.py,sha256=Z372NhIhZcJ92DLPlOq44gTu8XqVcw05SOeJ1BaU7zE,6767
24
+ platzky/models.py,sha256=Ws5ZSWf5EhcpFxl3Yeze2pQiesjnjAA_haBJ90bN6lk,7435
25
25
  platzky/platzky.py,sha256=1LKYq8pLm1QBlOcEPhugxWi8W0vuWqjjINIFK8b2Kow,9319
26
26
  platzky/plugin/plugin.py,sha256=KZb6VEph__lx9xrv5Ay4h4XkFFYbodV5OimaG6B9IDc,2812
27
27
  platzky/plugin/plugin_loader.py,sha256=eKG6zodUCkiRLxJ2ZX9zdN4-ZrZ9EwssoY1SDtThaFo,6707
28
- platzky/seo/seo.py,sha256=yEyoRzXNXV9lyqnHSGW8mewC3_vYzyQFHI3EuRrd8ao,3805
28
+ platzky/seo/seo.py,sha256=cguipDKHYBd0J4M8q8t5QNk3bmUIavXp9V3Ugv0UouU,3854
29
29
  platzky/static/blog.css,sha256=TrppzgQbj4UtuTufDCdblyNTVAqgIbhD66Cziyv_xnY,7893
30
30
  platzky/static/styles.css,sha256=U5ddGIK-VcGRJZ3BdOpMp0pR__k6rNEMsuQXkP4tFQ0,686
31
31
  platzky/telemetry.py,sha256=iXYvEt0Uw5Hx8lAxyr45dpQ_SiE2NxmJkoSx-JSRJyM,5011
@@ -41,7 +41,7 @@ platzky/templates/post.html,sha256=GSgjIZsOQKtNx3cEbquSjZ5L4whPnG6MzRyoq9k4B8Q,1
41
41
  platzky/templates/robots.txt,sha256=2_j2tiYtYJnzZUrANiX9pvBxyw5Dp27fR_co18BPEJ0,116
42
42
  platzky/templates/sitemap.xml,sha256=iIJZ91_B5ZuNLCHsRtsGKZlBAXojOTP8kffqKLacgvs,578
43
43
  platzky/www_handler.py,sha256=pF6Rmvem1sdVqHD7z3RLrDuG-CwAqfGCti50_NPsB2w,725
44
- platzky-1.2.0.dist-info/METADATA,sha256=N32Pfi0ph7na4fWV4U-mM9B89BwCTtMCErfDpFJDU1I,2556
45
- platzky-1.2.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
46
- platzky-1.2.0.dist-info/licenses/LICENSE,sha256=wCdfk-qEosi6BDwiBulMfKMi0hxp1UXV0DdjLrRm788,1077
47
- platzky-1.2.0.dist-info/RECORD,,
44
+ platzky-1.2.1.dist-info/METADATA,sha256=0LIO-7G1YnqVwinorr24GPlOBBE0RPIR_Q99FfuvrkA,2556
45
+ platzky-1.2.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
46
+ platzky-1.2.1.dist-info/licenses/LICENSE,sha256=wCdfk-qEosi6BDwiBulMfKMi0hxp1UXV0DdjLrRm788,1077
47
+ platzky-1.2.1.dist-info/RECORD,,