CCBot/2.0 (https://commoncrawl.org/faq/) TLS_AES_256_GCM_SHA384
FEED ME A STRAY CAT

Demo Post

Wed, Dec 31 1969 - 11:59

Just testing out some stuff, nothing to see here…

Such section, many wow, ayy lmao

they're coming with peace

Bippity

boppity

bonk!

Dick Spencer getting bonked on the noggin.

Listen to Zoidberg

He's right, you know?

Some text

A new section

And some more text in that section.

As well as another section

With even more text.

Also, some code, hopefully with working highlighting

# builtins
import time

# third-party
import peewee
import playhouse.db_url

# internals
from application import app
import util
import rendering

# NOTE: autorollback is deprecated in most current release of peewee, but development is done with 3.15.0
app.db = playhouse.db_url.connect(app.config['DATABASE'], autorollback=True)

@app.before_request
def db_connect():

    try:

        app.db.connect(reuse_if_open=True)
        app.db.set_time_zone('UTC')

    except peewee.OperationalError as e:
        app.logger.error(f"Error connecting to database: {str(e)}")

class ModelMeta(peewee.ModelBase, util.ChildAwareMeta):
    pass

@app.abstract
class Model(peewee.Model, util.ChildAware, metaclass=ModelMeta):

    class Meta:
        database = app.db

    def __init_subclass__(cls):

        # this makes subclasses sortable for use in installation.
        # as long as model classes are defined in the right order
        # in here the installation will have no trouble with
        # foreign keys to tables that don't yet exist.
        cls.__class_created__ = time.time()

@app.abstract
class RenderableModel(rendering.Renderable, Model):

    def __init__(self, *args, extra_classes=None, **kwargs):

        # we need the model handling from peewee
        super(Model, self).__init__(*args, **kwargs) # peewee.Model.__init__
        # but also want base features from Renderable to work
        super().__init__(extra_classes=extra_classes) # Renderable.__init__