platzky 0.2.3__py3-none-any.whl → 0.2.5__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/db/db.py +1 -5
- platzky/db/graph_ql_db.py +11 -4
- platzky/db/json_db.py +13 -13
- platzky/plugins/google-tag-manager/entrypoint.py +29 -0
- platzky/templates/base.html +2 -2
- platzky/templates/head_meta.html +1 -1
- {platzky-0.2.3.dist-info → platzky-0.2.5.dist-info}/METADATA +1 -1
- {platzky-0.2.3.dist-info → platzky-0.2.5.dist-info}/RECORD +9 -8
- {platzky-0.2.3.dist-info → platzky-0.2.5.dist-info}/WHEEL +0 -0
platzky/db/db.py
CHANGED
|
@@ -14,7 +14,7 @@ class DB(ABC):
|
|
|
14
14
|
|
|
15
15
|
def __init_subclass__(cls, *args, **kw):
|
|
16
16
|
"""Check that all methods defined in the subclass exist in the superclasses.
|
|
17
|
-
This is to prevent subclasses from
|
|
17
|
+
This is to prevent subclasses from splitting up DB interface.
|
|
18
18
|
"""
|
|
19
19
|
super().__init_subclass__(*args, **kw)
|
|
20
20
|
for name in cls.__dict__:
|
|
@@ -90,10 +90,6 @@ class DB(ABC):
|
|
|
90
90
|
def get_font(self) -> str:
|
|
91
91
|
pass
|
|
92
92
|
|
|
93
|
-
@abstractmethod
|
|
94
|
-
def get_site_content(self) -> str:
|
|
95
|
-
pass
|
|
96
|
-
|
|
97
93
|
|
|
98
94
|
class DBConfig(BaseModel):
|
|
99
95
|
type: str = Field(alias="TYPE")
|
platzky/db/graph_ql_db.py
CHANGED
|
@@ -232,8 +232,15 @@ class GraphQL(DB):
|
|
|
232
232
|
def get_secondary_color(self):
|
|
233
233
|
return Color()
|
|
234
234
|
|
|
235
|
-
def get_site_content(self):
|
|
236
|
-
return ""
|
|
237
|
-
|
|
238
235
|
def get_plugins_data(self):
|
|
239
|
-
|
|
236
|
+
plugins_data = gql(
|
|
237
|
+
"""
|
|
238
|
+
query MyQuery {
|
|
239
|
+
pluginConfigs(stage: PUBLISHED) {
|
|
240
|
+
name
|
|
241
|
+
config
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
"""
|
|
245
|
+
)
|
|
246
|
+
return self.client.execute(plugins_data)["pluginConfigs"]
|
platzky/db/json_db.py
CHANGED
|
@@ -34,13 +34,13 @@ class Json(DB):
|
|
|
34
34
|
def get_all_posts(self, lang):
|
|
35
35
|
return [
|
|
36
36
|
Post.model_validate(post)
|
|
37
|
-
for post in self.
|
|
37
|
+
for post in self._get_site_content().get("posts", ())
|
|
38
38
|
if post["language"] == lang
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
def get_post(self, slug: str) -> Post:
|
|
42
42
|
"""Returns a post matching the given slug."""
|
|
43
|
-
all_posts = self.
|
|
43
|
+
all_posts = self._get_site_content().get("posts")
|
|
44
44
|
if all_posts is None:
|
|
45
45
|
raise ValueError("Posts data is missing")
|
|
46
46
|
wanted_post = next((post for post in all_posts if post["slug"] == slug), None)
|
|
@@ -52,39 +52,39 @@ class Json(DB):
|
|
|
52
52
|
def get_page(self, slug):
|
|
53
53
|
list_of_pages = (
|
|
54
54
|
page
|
|
55
|
-
for page in self.
|
|
55
|
+
for page in self._get_site_content().get("pages")
|
|
56
56
|
if page["slug"] == slug
|
|
57
57
|
)
|
|
58
58
|
page = Post.model_validate(next(list_of_pages))
|
|
59
59
|
return page
|
|
60
60
|
|
|
61
61
|
def get_menu_items(self) -> list[MenuItem]:
|
|
62
|
-
menu_items_raw = self.
|
|
62
|
+
menu_items_raw = self._get_site_content().get("menu_items", [])
|
|
63
63
|
menu_items_list = [MenuItem.model_validate(x) for x in menu_items_raw]
|
|
64
64
|
return menu_items_list
|
|
65
65
|
|
|
66
66
|
def get_posts_by_tag(self, tag, lang):
|
|
67
67
|
return (
|
|
68
|
-
post for post in self.
|
|
68
|
+
post for post in self._get_site_content()["posts"] if tag in post["tags"]
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
def
|
|
71
|
+
def _get_site_content(self):
|
|
72
72
|
content = self.data.get("site_content")
|
|
73
73
|
if content is None:
|
|
74
74
|
raise Exception("Content should not be None")
|
|
75
75
|
return content
|
|
76
76
|
|
|
77
77
|
def get_logo_url(self):
|
|
78
|
-
return self.
|
|
78
|
+
return self._get_site_content().get("logo_url", "")
|
|
79
79
|
|
|
80
80
|
def get_font(self) -> str:
|
|
81
|
-
return self.
|
|
81
|
+
return self._get_site_content().get("font", "")
|
|
82
82
|
|
|
83
83
|
def get_primary_color(self):
|
|
84
|
-
return self.
|
|
84
|
+
return self._get_site_content().get("primary_color", "white")
|
|
85
85
|
|
|
86
86
|
def get_secondary_color(self):
|
|
87
|
-
return self.
|
|
87
|
+
return self._get_site_content().get("secondary_color", "navy")
|
|
88
88
|
|
|
89
89
|
def add_comment(self, author_name, comment, post_slug):
|
|
90
90
|
comment = {
|
|
@@ -95,10 +95,10 @@ class Json(DB):
|
|
|
95
95
|
|
|
96
96
|
post_index = next(
|
|
97
97
|
i
|
|
98
|
-
for i in range(len(self.
|
|
99
|
-
if self.
|
|
98
|
+
for i in range(len(self._get_site_content()["posts"]))
|
|
99
|
+
if self._get_site_content()["posts"][i]["slug"] == post_slug
|
|
100
100
|
)
|
|
101
|
-
self.
|
|
101
|
+
self._get_site_content()["posts"][post_index]["comments"].append(comment)
|
|
102
102
|
|
|
103
103
|
def get_plugins_data(self):
|
|
104
104
|
return self.data.get("plugins", [])
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
def process(app, plugin_config):
|
|
2
|
+
gtm_id = plugin_config["ID"]
|
|
3
|
+
|
|
4
|
+
head_code = (
|
|
5
|
+
"""<!-- Google Tag Manager -->
|
|
6
|
+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
7
|
+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
8
|
+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
9
|
+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
10
|
+
})(window,document,'script','dataLayer','"""
|
|
11
|
+
+ gtm_id
|
|
12
|
+
+ """');</script>
|
|
13
|
+
<!-- End Google Tag Manager -->
|
|
14
|
+
"""
|
|
15
|
+
)
|
|
16
|
+
app.add_dynamic_head(head_code)
|
|
17
|
+
|
|
18
|
+
body = (
|
|
19
|
+
"""<!-- Google Tag Manager (noscript) -->
|
|
20
|
+
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id="""
|
|
21
|
+
+ gtm_id
|
|
22
|
+
+ """
|
|
23
|
+
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|
24
|
+
<!-- End Google Tag Manager (noscript) -->
|
|
25
|
+
"""
|
|
26
|
+
)
|
|
27
|
+
app.add_dynamic_body(body)
|
|
28
|
+
|
|
29
|
+
return app
|
platzky/templates/base.html
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang="{{
|
|
2
|
+
<html lang="{{ current_language }}">
|
|
3
3
|
<head>
|
|
4
4
|
{% block head_meta %}
|
|
5
5
|
{% include "head_meta.html" %}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.Default.css" />
|
|
12
12
|
<link rel="stylesheet" href="{{ font.url }}">
|
|
13
13
|
{% endblock %}
|
|
14
|
-
<title>{% block title %}{% endblock %}</title>
|
|
14
|
+
<title>{% block title %} {{app_name}} {% endblock %}</title>
|
|
15
15
|
<meta name="description" content=" {% block description %} {% endblock %} ">
|
|
16
16
|
<style>
|
|
17
17
|
html,
|
platzky/templates/head_meta.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- Required meta tags -->
|
|
2
2
|
<meta charset="utf-8">
|
|
3
3
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
4
|
-
<link rel="alternate" hreflang="{{
|
|
4
|
+
<link rel="alternate" hreflang="{{ current_language }}" href="{{ request.base_url }}"/>
|
|
5
5
|
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}" type="image/x-icon">
|
|
6
6
|
|
|
7
7
|
<link rel="canonical" href="{{ request.base_url }}"/>
|
|
@@ -4,31 +4,32 @@ platzky/blog/blog.py,sha256=R1Otio2Ix5d02CT9mtYZ_kKMbKJArsuJdJLjCfc4Qxg,3031
|
|
|
4
4
|
platzky/blog/comment_form.py,sha256=4lkNJ_S_2DZmJBbz-NPDqahvy2Zz5AGNH2spFeGIop4,513
|
|
5
5
|
platzky/config.py,sha256=XL4oASEZQtc6iNfiLkAJaHp9fUX3A53DEpCXznYyOrQ,2203
|
|
6
6
|
platzky/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
platzky/db/db.py,sha256=
|
|
7
|
+
platzky/db/db.py,sha256=1SzKuWKHgcHMnPPclRfvkgicMJOVMjmtHZnyc5OcKO8,2577
|
|
8
8
|
platzky/db/db_loader.py,sha256=CuEiXxhIa4bFMm0vi7ugzm7j3WycilGRKCU6smgIImE,905
|
|
9
9
|
platzky/db/google_json_db.py,sha256=65NKwbalGA1FfQz724dAK_3PS9e-MeLUb7WZkVU6nBo,1513
|
|
10
|
-
platzky/db/graph_ql_db.py,sha256=
|
|
11
|
-
platzky/db/json_db.py,sha256=
|
|
10
|
+
platzky/db/graph_ql_db.py,sha256=fJfSvoKLTSMNz4UXgIiV4-GnVDAYx33f1nrTNx8_pjQ,6661
|
|
11
|
+
platzky/db/json_db.py,sha256=Bz3uxI47ritKCN5HR2vxlbXTRZSIx7mP9N4jTzifGXA,3197
|
|
12
12
|
platzky/db/json_file_db.py,sha256=UQ8TadELmqOzj_tgNfmzhtCkDkMAgcB9vaUy0GQXUY4,1010
|
|
13
13
|
platzky/models.py,sha256=8ATKVrGRtQ1JV_z7IdYbx1cxBU7ISoXjTmNxTlxok-k,1450
|
|
14
14
|
platzky/platzky.py,sha256=3KljmS4lTB1yscOSDoavZ2yFwHcdQ_K8Om8qlJBA73U,4649
|
|
15
15
|
platzky/plugin_loader.py,sha256=KYLDSEd_hseAgBuSbikerU_IFx-YmcYK5UwYw7kla2E,1106
|
|
16
|
+
platzky/plugins/google-tag-manager/entrypoint.py,sha256=yY5UqFvSdj3tt2upwNS8JkTrKcrbwlaaE2XQ6sRiGLc,1011
|
|
16
17
|
platzky/plugins/redirections/entrypoint.py,sha256=HZsZBr8f7UkdYW0AJfUuG1vdEvWcpjoWMfm3cUXVHD4,1565
|
|
17
18
|
platzky/plugins/sendmail/entrypoint.py,sha256=ioVUh_YgxyA4DnHRBUbg9ze08EKX_iCbFhbK145icjE,1237
|
|
18
19
|
platzky/seo/seo.py,sha256=5Rl-ZQ3DWw65x0V7mpIkmUfxXTb6i5PEbIrAX7pzV70,2710
|
|
19
20
|
platzky/static/blog.css,sha256=jF-8ykgpbPp58SCUqygBhCm4o7ggULojbxpnk6Jbx3c,7895
|
|
20
21
|
platzky/templates/404.html,sha256=EheoLSWylOscLH8FmcMA4c6Jw14i5HkSvE_GXzGIrUo,78
|
|
21
|
-
platzky/templates/base.html,sha256=
|
|
22
|
+
platzky/templates/base.html,sha256=XpY5GOsuXiroLzSo0sQqIMIGSGx5AyhdHQOK9ioxVXM,4988
|
|
22
23
|
platzky/templates/blog.html,sha256=aPl-DzLX85bHv7tN8UjlABR086PUJ9IGlGbIBioFHGA,1281
|
|
23
24
|
platzky/templates/body_meta.html,sha256=au61f54ZK8SdovSpoUROjyy5fi3K6n_N5P-QjW7S5-8,526
|
|
24
25
|
platzky/templates/feed.xml,sha256=I9cz7vnxx-TfbLIDHFXfrC3S2Nt9B6PrWf3u4zSIi78,863
|
|
25
|
-
platzky/templates/head_meta.html,sha256=
|
|
26
|
+
platzky/templates/head_meta.html,sha256=AEUPScGOBOQl6OIZ6NhcY0Sh3A17T8KHwJ3hmI4AYuA,1380
|
|
26
27
|
platzky/templates/home.html,sha256=nqoVVvaNBd1ceun6KOZB_eY20xf4Mjtu8LTl1Q_Ap6c,3900
|
|
27
28
|
platzky/templates/page.html,sha256=8tS9K5dXfCKItvOlpEuURnWohnWjs6WW6zeBJFLARUM,647
|
|
28
29
|
platzky/templates/post.html,sha256=GSgjIZsOQKtNx3cEbquSjZ5L4whPnG6MzRyoq9k4B8Q,1906
|
|
29
30
|
platzky/templates/robots.txt,sha256=2_j2tiYtYJnzZUrANiX9pvBxyw5Dp27fR_co18BPEJ0,116
|
|
30
31
|
platzky/templates/sitemap.xml,sha256=iIJZ91_B5ZuNLCHsRtsGKZlBAXojOTP8kffqKLacgvs,578
|
|
31
32
|
platzky/www_handler.py,sha256=pF6Rmvem1sdVqHD7z3RLrDuG-CwAqfGCti50_NPsB2w,725
|
|
32
|
-
platzky-0.2.
|
|
33
|
-
platzky-0.2.
|
|
34
|
-
platzky-0.2.
|
|
33
|
+
platzky-0.2.5.dist-info/METADATA,sha256=201srerrBPL9m4s5uKqXXKYPx9VAByaOQrKMt36KwIk,1591
|
|
34
|
+
platzky-0.2.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
35
|
+
platzky-0.2.5.dist-info/RECORD,,
|
|
File without changes
|