platzky 0.2.0__tar.gz → 0.2.2__tar.gz

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.
Files changed (34) hide show
  1. {platzky-0.2.0 → platzky-0.2.2}/PKG-INFO +2 -1
  2. {platzky-0.2.0 → platzky-0.2.2}/platzky/db/db.py +0 -8
  3. {platzky-0.2.0 → platzky-0.2.2}/platzky/db/graph_ql_db.py +12 -36
  4. {platzky-0.2.0 → platzky-0.2.2}/platzky/db/json_db.py +0 -6
  5. {platzky-0.2.0 → platzky-0.2.2}/pyproject.toml +2 -2
  6. {platzky-0.2.0 → platzky-0.2.2}/README.md +0 -0
  7. {platzky-0.2.0 → platzky-0.2.2}/platzky/__init__.py +0 -0
  8. {platzky-0.2.0 → platzky-0.2.2}/platzky/blog/__init__.py +0 -0
  9. {platzky-0.2.0 → platzky-0.2.2}/platzky/blog/blog.py +0 -0
  10. {platzky-0.2.0 → platzky-0.2.2}/platzky/blog/comment_form.py +0 -0
  11. {platzky-0.2.0 → platzky-0.2.2}/platzky/config.py +0 -0
  12. {platzky-0.2.0 → platzky-0.2.2}/platzky/db/__init__.py +0 -0
  13. {platzky-0.2.0 → platzky-0.2.2}/platzky/db/db_loader.py +0 -0
  14. {platzky-0.2.0 → platzky-0.2.2}/platzky/db/google_json_db.py +0 -0
  15. {platzky-0.2.0 → platzky-0.2.2}/platzky/db/json_file_db.py +0 -0
  16. {platzky-0.2.0 → platzky-0.2.2}/platzky/models.py +0 -0
  17. {platzky-0.2.0 → platzky-0.2.2}/platzky/platzky.py +0 -0
  18. {platzky-0.2.0 → platzky-0.2.2}/platzky/plugin_loader.py +0 -0
  19. {platzky-0.2.0 → platzky-0.2.2}/platzky/plugins/redirections/entrypoint.py +0 -0
  20. {platzky-0.2.0 → platzky-0.2.2}/platzky/plugins/sendmail/entrypoint.py +0 -0
  21. {platzky-0.2.0 → platzky-0.2.2}/platzky/seo/seo.py +0 -0
  22. {platzky-0.2.0 → platzky-0.2.2}/platzky/static/blog.css +0 -0
  23. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/404.html +0 -0
  24. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/base.html +0 -0
  25. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/blog.html +0 -0
  26. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/body_meta.html +0 -0
  27. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/feed.xml +0 -0
  28. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/head_meta.html +0 -0
  29. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/home.html +0 -0
  30. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/page.html +0 -0
  31. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/post.html +0 -0
  32. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/robots.txt +0 -0
  33. {platzky-0.2.0 → platzky-0.2.2}/platzky/templates/sitemap.xml +0 -0
  34. {platzky-0.2.0 → platzky-0.2.2}/platzky/www_handler.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: platzky
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Not only blog engine
5
5
  License: MIT
6
6
  Requires-Python: >=3.10,<4.0
@@ -18,6 +18,7 @@ Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
18
18
  Requires-Dist: google-cloud-storage (>=2.5.0,<3.0.0)
19
19
  Requires-Dist: gql (>=3.4.0,<4.0.0)
20
20
  Requires-Dist: humanize (>=4.9.0,<5.0.0)
21
+ Requires-Dist: pydantic (>=2.7.1,<3.0.0)
21
22
  Description-Content-Type: text/markdown
22
23
 
23
24
  ![Github Actions](https://github.com/platzky/platzky/actions/workflows/tests.yml/badge.svg?event=push&branch=main)
@@ -90,14 +90,6 @@ class DB(ABC):
90
90
  def get_font(self) -> str:
91
91
  pass
92
92
 
93
- @abstractmethod
94
- def get_all_providers(self): # TODO providers are not part of the DB
95
- pass
96
-
97
- @abstractmethod
98
- def get_all_questions(self): # TODO questions are not part of the DB
99
- pass
100
-
101
93
  @abstractmethod
102
94
  def get_site_content(self) -> str:
103
95
  pass
@@ -1,6 +1,5 @@
1
1
  # TODO rename file, extract it to another library, remove qgl and aiohttp from dependencies
2
2
 
3
- import json
4
3
 
5
4
  from gql import Client, gql
6
5
  from gql.transport.aiohttp import AIOHTTPTransport
@@ -27,14 +26,24 @@ def db_from_config(config: GraphQlDbConfig):
27
26
  return GraphQL(config.endpoint, config.token)
28
27
 
29
28
 
30
- def _standarize_post(post):
29
+ def _standarize_comment(
30
+ comment,
31
+ ): # TODO add tests for checking stadarization of comments
32
+ return {
33
+ "author": comment["author"],
34
+ "comment": comment["comment"],
35
+ "date": comment["createdAt"],
36
+ }
37
+
38
+
39
+ def _standarize_post(post): # TODO add tests for checking stadarization of posts
31
40
  return {
32
41
  "author": post["author"]["name"],
33
42
  "slug": post["slug"],
34
43
  "title": post["title"],
35
44
  "excerpt": post["excerpt"],
36
45
  "contentInMarkdown": post["contentInRichText"]["html"],
37
- "comments": post["comments"],
46
+ "comments": [_standarize_comment(comment) for comment in post["comments"]],
38
47
  "tags": post["tags"],
39
48
  "language": post["language"],
40
49
  "coverImage": {
@@ -186,39 +195,6 @@ class GraphQL(DB):
186
195
  "posts"
187
196
  ]
188
197
 
189
- def get_all_providers(self):
190
- all_providers = gql(
191
- """
192
- query MyQuery {
193
- providers(stage: PUBLISHED) {
194
- link
195
- name
196
- offer
197
- currency
198
- }
199
- }
200
- """
201
- )
202
- providers = self.client.execute(all_providers)["providers"]
203
- for provider in providers:
204
- provider["offer"] = json.loads(provider["offer"])
205
- return providers
206
-
207
- def get_all_questions(self):
208
- all_questions = gql(
209
- """
210
- query MyQuery {
211
- questions(stage: PUBLISHED) {
212
- question
213
- field
214
- inputType
215
- }
216
- }
217
- """
218
- )
219
- query = self.client.execute(all_questions)
220
- return query["questions"]
221
-
222
198
  def add_comment(self, author_name, comment, post_slug):
223
199
  add_comment = gql(
224
200
  """
@@ -68,12 +68,6 @@ class Json(DB):
68
68
  post for post in self.get_site_content()["posts"] if tag in post["tags"]
69
69
  )
70
70
 
71
- def get_all_providers(self):
72
- return self.data["providers"]
73
-
74
- def get_all_questions(self):
75
- return self.data["questions"]
76
-
77
71
  def get_site_content(self):
78
72
  content = self.data.get("site_content")
79
73
  if content is None:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "platzky"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "Not only blog engine"
5
5
  authors = []
6
6
  license = "MIT"
@@ -17,13 +17,13 @@ aiohttp = "^3.9.5"
17
17
  Flask-Minify = "^0.42"
18
18
  google-cloud-storage = "^2.5.0"
19
19
  humanize = "^4.9.0"
20
+ pydantic = "^2.7.1"
20
21
 
21
22
  [tool.poetry.group.dev.dependencies]
22
23
  pytest = "^8.2.1"
23
24
  coverage = "^7.5.1"
24
25
  pytest-cov = "^5.0.0"
25
26
  freezegun = "^1.2.2"
26
- pydantic = "^2.7.1"
27
27
  black = "^24.4.2"
28
28
  ruff = "^0.4.4"
29
29
  pyright = "^1.1.364"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes