Skip to main content

ยท One min read
Sasen Perera

Changesโ€‹

  • Added Test Fixtures for server.
import pytest

def client_can_send_requests(server, client):
RESPONSE_TEXT = "THIS IS COOL"
@server.route("/test")
def test(request, response):
response.text = RESPONSE_TEXT

assert client.get("http://testserver/hey").text == RESPONSE_TEXT
  • Added Exception Handler (the text you get when a server gets an error)
class ExceptionComponent(Component):
name = "ExceptionComponent"

def item(props: dict):
return """
<style>
body {
background-color: #000;
color: #fff;
}
h1 {
font-size: 3rem;
font-weight: 300;
color: #0af0fa;
}
h2 {
font-size: 2rem;
font-weight: 300;
}
p {
font-size: 1.5rem;
font-weight: 300;
}
</style>
<div class='container'>
<h1>001010100101101010010100101</h1>
<h2>Looks like something went wrong</h2>
<p>Please try again later......</p>
</div>
"""

def custom_exception_handler(request, response, exception_cls):
response.text = root.render("<ExceptionComponent/>")

app.add_exception_handler(custom_exception_handler)
  • Django Like Routing (since of this, blueprinting is now achievable: check examples/Lemon-App)
from Lemon.Server import server

app = server.Server(None)

def index(request, response):
response.text = "Hello, world!"

app.add_route("/", index)

app.run()
  • Updated create-react-app.

Full Changelog: https://github.com/Sas2k/Lemon/compare/V.1.2.6...V.1.3.0

Until Next Time Good Day people!

ยท One min read
Sasen Perera

Changesโ€‹

  • Changed the way, how the ORM functions
#base.py
from Lemon.orm import DBManager, migrations

baseModel = DBManager.baseModel
ClassBase = DBManager.base
migrate = migrations.MigrateCommand

class model(baseModel):
base_model = ClassBase
tablename = "model"
fields = ("field1", "field2")

model_list = [model]

migrate(model_list).migrate()
#models.py
from Lemon.orm.DBManager import SqliteManager

sql = SqliteManager("../model.db")
sql.insert("model", [("field1", "field2"), ("Hello", "World")])
  • Finished the Tutorial on Docs.

  • Updated create-lemon-app Models/Models.py, Models/__init__.py and app.py updated

  • Added Versioning Tags to Docs

Full Changelog: https://github.com/Sas2k/Lemon/compare/V.1.0.0...V.1.2.0

Until Next Time Good Day people!

ยท One min read
Sasen Perera

This is the very first post on the blog.

This blog will give updates on Lemon and it's Development

Github: https://github.com/Sas2k/Lemon

Until the next one, Good day people!