platzky 0.1.18__py3-none-any.whl → 0.2.0__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.
@@ -5,7 +5,7 @@
5
5
  {% endblock %}
6
6
 
7
7
  {% block content %}
8
- <header class="masthead" style="background-image: url({{post.coverImage.image.url}})">
8
+ <header class="masthead" style="background-image: url({{post.coverImage.url}})">
9
9
  <div class="overlay"></div>
10
10
  <div class="container">
11
11
  <div class="row">
@@ -23,7 +23,7 @@
23
23
  <div class="container">
24
24
  <div class="row">
25
25
  <div class="col-lg-8 col-md-10 mx-auto post-content">
26
- {{post.contentInRichText.markdown | markdown}}
26
+ {{post.contentInMarkdown | markdown}}
27
27
  </div>
28
28
  </div>
29
29
  </div>
platzky/www_handler.py CHANGED
@@ -1,13 +1,15 @@
1
1
  import urllib.parse
2
- from flask import request, redirect
2
+
3
+ from flask import redirect, request
3
4
 
4
5
 
5
6
  def redirect_nonwww_to_www():
6
7
  """Redirect non-www requests to www."""
7
8
  urlparts = urllib.parse.urlparse(request.url)
8
9
  if not urlparts.netloc.startswith("www."):
9
- urlparts = urlparts._replace(netloc=f'www.{urlparts.netloc}')
10
- return redirect(urllib.parse.urlunparse(urlparts), code=301)
10
+ urlparts = urlparts._replace(netloc=f"www.{urlparts.netloc}")
11
+ url = urllib.parse.urlunparse(urlparts)
12
+ return redirect(url, code=301)
11
13
 
12
14
 
13
15
  def redirect_www_to_nonwww():
@@ -15,4 +17,5 @@ def redirect_www_to_nonwww():
15
17
  urlparts = urllib.parse.urlparse(request.url)
16
18
  if urlparts.netloc.startswith("www."):
17
19
  urlparts = urlparts._replace(netloc=urlparts.netloc.removeprefix("www."))
18
- return redirect(urllib.parse.urlunparse(urlparts), code=301)
20
+ url = urllib.parse.urlunparse(urlparts)
21
+ return redirect(url, code=302)
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.1
2
+ Name: platzky
3
+ Version: 0.2.0
4
+ Summary: Not only blog engine
5
+ License: MIT
6
+ Requires-Python: >=3.10,<4.0
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Requires-Dist: Flask (==3.0.3)
13
+ Requires-Dist: Flask-Babel (>=4.0.0,<5.0.0)
14
+ Requires-Dist: Flask-Minify (>=0.42,<0.43)
15
+ Requires-Dist: Flask-WTF (>=1.2.1,<2.0.0)
16
+ Requires-Dist: PyYAML (>=6.0,<7.0)
17
+ Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
18
+ Requires-Dist: google-cloud-storage (>=2.5.0,<3.0.0)
19
+ Requires-Dist: gql (>=3.4.0,<4.0.0)
20
+ Requires-Dist: humanize (>=4.9.0,<5.0.0)
21
+ Description-Content-Type: text/markdown
22
+
23
+ ![Github Actions](https://github.com/platzky/platzky/actions/workflows/tests.yml/badge.svg?event=push&branch=main)
24
+ [![Coverage Status](https://coveralls.io/repos/github/platzky/platzky/badge.svg?branch=main)](https://coveralls.io/github/platzky/platzky?branch=main)
25
+
26
+ # platzky
27
+
28
+ Platzky is engine which aims to provide simple and easy way to create and run web applications in python.
29
+
30
+ # How to use?
31
+
32
+ 1. Install platzky with your favorite dependency management tool (`pip install platzky` or `poetry add platzky`).
33
+ 2. Copy `config-template.yml` to your project directory and fill it with your data.
34
+ 3. Run `flask --app "platzky.platzky:create_app(config_path='PATH_TO_YOUR_CONFIG_FILE')`
35
+
36
+ ## Example
37
+
38
+ For examples check e2e tests in `tests/e2e` directory and Makefile.
39
+
@@ -0,0 +1,34 @@
1
+ platzky/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ platzky/blog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ platzky/blog/blog.py,sha256=R1Otio2Ix5d02CT9mtYZ_kKMbKJArsuJdJLjCfc4Qxg,3031
4
+ platzky/blog/comment_form.py,sha256=4lkNJ_S_2DZmJBbz-NPDqahvy2Zz5AGNH2spFeGIop4,513
5
+ platzky/config.py,sha256=XL4oASEZQtc6iNfiLkAJaHp9fUX3A53DEpCXznYyOrQ,2203
6
+ platzky/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ platzky/db/db.py,sha256=1Ey7B-mc8QQyP4n3YbnA96PzWNTbrnXtTpMDNCg34nc,2876
8
+ platzky/db/db_loader.py,sha256=CuEiXxhIa4bFMm0vi7ugzm7j3WycilGRKCU6smgIImE,905
9
+ platzky/db/google_json_db.py,sha256=65NKwbalGA1FfQz724dAK_3PS9e-MeLUb7WZkVU6nBo,1513
10
+ platzky/db/graph_ql_db.py,sha256=1MmesGRqMZzsvGPkwA2DwwE4QLc-q0lsxfg3oBwin4A,6974
11
+ platzky/db/json_db.py,sha256=UIZSWxqB2aCiL1WjSFLEOLVNQx-qCJ_66wHYlaSqD0A,3328
12
+ platzky/db/json_file_db.py,sha256=UQ8TadELmqOzj_tgNfmzhtCkDkMAgcB9vaUy0GQXUY4,1010
13
+ platzky/models.py,sha256=8ATKVrGRtQ1JV_z7IdYbx1cxBU7ISoXjTmNxTlxok-k,1450
14
+ platzky/platzky.py,sha256=3KljmS4lTB1yscOSDoavZ2yFwHcdQ_K8Om8qlJBA73U,4649
15
+ platzky/plugin_loader.py,sha256=KYLDSEd_hseAgBuSbikerU_IFx-YmcYK5UwYw7kla2E,1106
16
+ platzky/plugins/redirections/entrypoint.py,sha256=HZsZBr8f7UkdYW0AJfUuG1vdEvWcpjoWMfm3cUXVHD4,1565
17
+ platzky/plugins/sendmail/entrypoint.py,sha256=ioVUh_YgxyA4DnHRBUbg9ze08EKX_iCbFhbK145icjE,1237
18
+ platzky/seo/seo.py,sha256=5Rl-ZQ3DWw65x0V7mpIkmUfxXTb6i5PEbIrAX7pzV70,2710
19
+ platzky/static/blog.css,sha256=jF-8ykgpbPp58SCUqygBhCm4o7ggULojbxpnk6Jbx3c,7895
20
+ platzky/templates/404.html,sha256=EheoLSWylOscLH8FmcMA4c6Jw14i5HkSvE_GXzGIrUo,78
21
+ platzky/templates/base.html,sha256=D9W3UHz3SmLBcqzCexD3pfvQWhK3c5crKvoa0SaaST4,4966
22
+ platzky/templates/blog.html,sha256=aPl-DzLX85bHv7tN8UjlABR086PUJ9IGlGbIBioFHGA,1281
23
+ platzky/templates/body_meta.html,sha256=au61f54ZK8SdovSpoUROjyy5fi3K6n_N5P-QjW7S5-8,526
24
+ platzky/templates/feed.xml,sha256=I9cz7vnxx-TfbLIDHFXfrC3S2Nt9B6PrWf3u4zSIi78,863
25
+ platzky/templates/head_meta.html,sha256=yFHTEYrVd8QsGPVJK4M-NsZ1OcDO8PU5qTvhP9mkPTk,1370
26
+ platzky/templates/home.html,sha256=nqoVVvaNBd1ceun6KOZB_eY20xf4Mjtu8LTl1Q_Ap6c,3900
27
+ platzky/templates/page.html,sha256=8tS9K5dXfCKItvOlpEuURnWohnWjs6WW6zeBJFLARUM,647
28
+ platzky/templates/post.html,sha256=GSgjIZsOQKtNx3cEbquSjZ5L4whPnG6MzRyoq9k4B8Q,1906
29
+ platzky/templates/robots.txt,sha256=2_j2tiYtYJnzZUrANiX9pvBxyw5Dp27fR_co18BPEJ0,116
30
+ platzky/templates/sitemap.xml,sha256=iIJZ91_B5ZuNLCHsRtsGKZlBAXojOTP8kffqKLacgvs,578
31
+ platzky/www_handler.py,sha256=pF6Rmvem1sdVqHD7z3RLrDuG-CwAqfGCti50_NPsB2w,725
32
+ platzky-0.2.0.dist-info/METADATA,sha256=I3Rb4nKIsnCShVi_acU6oXFrl9TAP7OWo_pe7bU26p4,1550
33
+ platzky-0.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
34
+ platzky-0.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.4.0
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
platzky/blog/db.py DELETED
@@ -1,18 +0,0 @@
1
- class DB:
2
- def get_all_posts(self, lang):
3
- pass
4
-
5
- def get_post(self, slug):
6
- pass
7
-
8
- def get_page(self, slug):
9
- pass
10
-
11
- def get_posts_by_tag(self, tag, lang):
12
- pass
13
-
14
- def get_menu(self):
15
- pass
16
-
17
- def add_comment(self, author_name, comment, post_slug):
18
- pass
@@ -1,16 +0,0 @@
1
- import datetime
2
- import humanize
3
-
4
-
5
- def get_delta(now, date_in):
6
- date = datetime.datetime.strptime(date_in.split(".")[0], "%Y-%m-%dT%H:%M:%S")
7
- delta = humanize.naturaltime(now - date)
8
- return delta
9
-
10
-
11
- def format_post(post):
12
- now = datetime.datetime.now()
13
- for comment in post["comments"]:
14
- comment.update({"time_delta": get_delta(now, comment["date"])})
15
- post["comments"].sort(key=lambda x: x["date"], reverse=True)
16
- return post
platzky/db_loader.py DELETED
@@ -1,25 +0,0 @@
1
- # from importlib.util import spec_from_file_location, module_from_spec
2
- # import os
3
- # import sys
4
- # from os.path import dirname, abspath
5
- #
6
- #
7
- # def load_db_driver(db_type):
8
- # db_dir = os.path.join(dirname(abspath(__file__)), 'db')
9
- # spec = spec_from_file_location(db_type, os.path.join(db_dir, db_type + "_db.py"))
10
- # db_driver = module_from_spec(spec)
11
- # sys.modules[f"$(db_type)_db"] = db_driver
12
- # spec.loader.exec_module(db_driver)
13
- # return db_driver
14
-
15
- from platzky.db import json_file_db, graph_ql_db, google_json_db
16
-
17
-
18
- def load_db_driver(db_type):
19
- db_type_to_db_loader = {
20
- "json_file": json_file_db,
21
- "google_json": google_json_db,
22
- "graph_ql": graph_ql_db
23
- }
24
-
25
- return db_type_to_db_loader[db_type]
@@ -1,39 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: platzky
3
- Version: 0.1.18
4
- Summary: Another blog in python
5
- License: MIT
6
- Requires-Python: >=3.10,<4.0
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Requires-Dist: Flask (>=2.2.2,<3.0.0)
12
- Requires-Dist: Flask-Babel (>=2.0.0,<3.0.0)
13
- Requires-Dist: Flask-Markdown (>=0.3,<0.4)
14
- Requires-Dist: Flask-Minify (>=0.39,<0.40)
15
- Requires-Dist: Flask-WTF (>=1.0.1,<2.0.0)
16
- Requires-Dist: PyYAML (>=6.0,<7.0)
17
- Requires-Dist: aiohttp (>=3.8.3,<4.0.0)
18
- Requires-Dist: google-cloud-storage (>=2.5.0,<3.0.0)
19
- Requires-Dist: gql (>=3.4.0,<4.0.0)
20
- Requires-Dist: humanize (>=4.3.0,<5.0.0)
21
- Description-Content-Type: text/markdown
22
-
23
- ![Github Actions](https://github.com/platzky/platzky/actions/workflows/tests.yml/badge.svg?event=push&branch=main)
24
- [![Coverage Status](https://coveralls.io/repos/github/platzky/platzky/badge.svg?branch=main)](https://coveralls.io/github/platzky/platzky?branch=main)
25
-
26
- # platzky
27
-
28
- Blog engine in python
29
-
30
- ## Configuration
31
-
32
- For details check `config.yml.tpl` file.
33
-
34
-
35
- # API
36
- `platzky.config.from_file(path_to_config)` - creates _platzky_ config from file (see __config.yml.tpl__)
37
- `platzky.create_app_from_config(config)` - creates _platzky_ application.
38
- `platzky.sendmail(receiver_email, subject, message)`- sends email from configured account
39
-
@@ -1,32 +0,0 @@
1
- platzky/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- platzky/blog/blog.py,sha256=jgsbmVlVFALZEqoewCXiTTAxVbnPF5irnCpeYHO6lE0,2552
3
- platzky/blog/comment_form.py,sha256=kBHN4IQGyDQrz_Fabh9UqtLi0yv22Rt6uTYCVgCs0U4,467
4
- platzky/blog/db.py,sha256=ZAyn663IYPxd1Qeff6m6jF4Cd7kf01Xg3h-M69y_Ytw,315
5
- platzky/blog/post_formatter.py,sha256=puS1P1z9nnWBK1_94VFvgNSeT2RmDrcVMnlSUS4AjxI,456
6
- platzky/config.py,sha256=lFT5e6i129J3XabuAunjtqPa55aG3af2MN3iTm_5ACg,1768
7
- platzky/db/google_json_db.py,sha256=RYFD3iXx0FtsD3DgxGZwqISt-P19WOF2TuY2GwFxdo8,951
8
- platzky/db/graph_ql_db.py,sha256=i1bKD9klOzvyGf_vSkmnh_5mJMRtXgW9SsBs6jSjKC0,5021
9
- platzky/db/json_db.py,sha256=wIo0yWtei12j36BzUyeDmqic5_qx4gouvh82fGd9XdE,1403
10
- platzky/db/json_file_db.py,sha256=wRk09EUSTDF_oxEEf97MxZnmmbffYy_FXtQznt59_rw,671
11
- platzky/db_loader.py,sha256=cGMhQ-DGDjSnKBacHIVpx3irWmLFmWtcf9ltgDFXSEE,753
12
- platzky/platzky.py,sha256=iWCej_4R2q3hvgTv5hVtEwkbLsbGA1nqD_OYphIBFew,3107
13
- platzky/plugin_loader.py,sha256=I-mUeXFTot7d4MNEgksVtD4b2tPSNvUFjzzi5ERBWTU,1407
14
- platzky/plugins/redirections/entrypoint.py,sha256=6d4DjmLvF4ioULE27jJWS9W_6zIz7yfKzufED569cIg,1145
15
- platzky/plugins/sendmail/entrypoint.py,sha256=jAznIF1FsZTrIfoLS5m1M0PP8prXEt7bw7V4iywb248,731
16
- platzky/seo/seo.py,sha256=hHcPIEJV1LLa2uplvarrGN5uavTihLez2zOXgr1Qrfg,2563
17
- platzky/static/blog.css,sha256=4yBmwfATrDboZ6E8RSsr3kN3wGKEpnZfWHd_hCR_870,8079
18
- platzky/templates/404.html,sha256=EheoLSWylOscLH8FmcMA4c6Jw14i5HkSvE_GXzGIrUo,78
19
- platzky/templates/base.html,sha256=oxk7lax0wVXLizJ_-Sq4RBwOv3QTC1pMF_s_7lz5rHw,1883
20
- platzky/templates/blog.html,sha256=8Ggb1VXAuP1oNUXn5CrtjB4kAyH0TfboDia6zs9Y2dw,1269
21
- platzky/templates/body_meta.html,sha256=JWJbpD3pDrJwtsk6-UJefOIVHQBbW3oXJskhlVcYXNk,1141
22
- platzky/templates/feed.xml,sha256=IxvH-cNDPmkQ-ddE5DI_bTmeXGeSH28D_33HeFyWyws,854
23
- platzky/templates/head_meta.html,sha256=pNxy48tC6CRHzpN03txWFM2efgcQSCshp_YR-u7Desg,1782
24
- platzky/templates/home.html,sha256=nqoVVvaNBd1ceun6KOZB_eY20xf4Mjtu8LTl1Q_Ap6c,3900
25
- platzky/templates/page.html,sha256=OzA6MRACSdnUTqaPJBkQFiHqlH82J8vgJTDCbFphY5A,647
26
- platzky/templates/post.html,sha256=sjjYZJZNzj1iivhdJlJDWpOnO5ZNb_pWfubj5xdDVZA,1921
27
- platzky/templates/robots.txt,sha256=2_j2tiYtYJnzZUrANiX9pvBxyw5Dp27fR_co18BPEJ0,116
28
- platzky/templates/sitemap.xml,sha256=iIJZ91_B5ZuNLCHsRtsGKZlBAXojOTP8kffqKLacgvs,578
29
- platzky/www_handler.py,sha256=J2ShAxLC1SZcKODeCfUVXhnzmbRDf--ZMVAOUn-y6co,688
30
- platzky-0.1.18.dist-info/METADATA,sha256=164H0s-qdhxh2TB8gMoCnM3SkELaoVE5C1dJkYJK9J0,1422
31
- platzky-0.1.18.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
32
- platzky-0.1.18.dist-info/RECORD,,