platzky 0.1.19__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.
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)
@@ -1,22 +1,23 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: platzky
3
- Version: 0.1.19
4
- Summary: Another blog in python
3
+ Version: 0.2.0
4
+ Summary: Not only blog engine
5
5
  License: MIT
6
6
  Requires-Python: >=3.10,<4.0
7
7
  Classifier: License :: OSI Approved :: MIT License
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.10
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-Minify (>=0.39,<0.40)
14
- Requires-Dist: Flask-WTF (>=1.0.1,<2.0.0)
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)
15
16
  Requires-Dist: PyYAML (>=6.0,<7.0)
16
- Requires-Dist: aiohttp (>=3.8.3,<4.0.0)
17
+ Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
17
18
  Requires-Dist: google-cloud-storage (>=2.5.0,<3.0.0)
18
19
  Requires-Dist: gql (>=3.4.0,<4.0.0)
19
- Requires-Dist: humanize (>=4.3.0,<5.0.0)
20
+ Requires-Dist: humanize (>=4.9.0,<5.0.0)
20
21
  Description-Content-Type: text/markdown
21
22
 
22
23
  ![Github Actions](https://github.com/platzky/platzky/actions/workflows/tests.yml/badge.svg?event=push&branch=main)
@@ -24,20 +25,15 @@ Description-Content-Type: text/markdown
24
25
 
25
26
  # platzky
26
27
 
27
- Blog engine in python
28
+ Platzky is engine which aims to provide simple and easy way to create and run web applications in python.
28
29
 
29
- # How to run?
30
+ # How to use?
30
31
 
31
- 1. Install platzky with your favorite dependency management tool (`pip install platzky`)
32
- 2. run `flask --app "platzky:create_app(PATH_TO_YOUR_CONFIG_FILE)" run`
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')`
33
35
 
34
- ## Configuration
36
+ ## Example
35
37
 
36
- For details check `config.yml.tpl` file.
37
-
38
-
39
- # API
40
- `platzky.config.from_file(path_to_config)` - creates _platzky_ config from file (see __config.yml.tpl__)
41
- `platzky.create_app_from_config(config)` - creates _platzky_ application.
42
- `platzky.sendmail(receiver_email, subject, message)`- sends email from configured account
38
+ For examples check e2e tests in `tests/e2e` directory and Makefile.
43
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,11 +0,0 @@
1
- from platzky.db import json_file_db, graph_ql_db, google_json_db
2
-
3
-
4
- def load_db_driver(db_type):
5
- db_type_to_db_loader = {
6
- "json_file": json_file_db,
7
- "google_json": google_json_db,
8
- "graph_ql": graph_ql_db
9
- }
10
-
11
- return db_type_to_db_loader[db_type]
@@ -1,32 +0,0 @@
1
- platzky/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- platzky/blog/blog.py,sha256=XczGxFKM3znNRzM9u1gGOiVXAtR1-TkHUoT1wUyiuAs,2590
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=Nxqy7vNoGEwvwG55cyUrrMzTdARmk48GdFxw-OcMD7w,1941
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=nfLU4YfqQlRNazddljopDWImDfQy3gUWFo81Xe1HIfI,279
12
- platzky/platzky.py,sha256=dy6KrOdHm18YbBMOIeMjnmdGKEZWaKAg1FslFru0WS0,3115
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=4YSsdYXnXi6vFDFrVfuZxCDC3PYWo-j--8lh0rWSNeE,735
16
- platzky/seo/seo.py,sha256=s8zmN6vzO-jKJCbfbCNNTJJdz9crdv0LM-_sxU7PAS4,2665
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=gGoQbRwDRqqYXX2dhJQ7E6iX1nhLx0X85Sf1VL4NVUw,1868
20
- platzky/templates/blog.html,sha256=8Ggb1VXAuP1oNUXn5CrtjB4kAyH0TfboDia6zs9Y2dw,1269
21
- platzky/templates/body_meta.html,sha256=JWJbpD3pDrJwtsk6-UJefOIVHQBbW3oXJskhlVcYXNk,1141
22
- platzky/templates/feed.xml,sha256=Ej0xPVZquxe2o9i0P2X0qwyBa0JFXoDjJthCm3X2-Ds,859
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=8tS9K5dXfCKItvOlpEuURnWohnWjs6WW6zeBJFLARUM,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.19.dist-info/METADATA,sha256=NAOsvs7mgN_Dcxcd-tH8-ZVxhthgoB5e9X29o2-xAF0,1555
31
- platzky-0.1.19.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
32
- platzky-0.1.19.dist-info/RECORD,,