Skip to content

Commit

Permalink
new appier version
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Oct 26, 2015
1 parent c232d9c commit d68def4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

setuptools.setup(
name = "appier",
version = "0.9.92",
version = "0.9.93",
author = "Hive Solutions Lda.",
author_email = "development@hive.pt",
description = "Appier Framework",
Expand Down
2 changes: 1 addition & 1 deletion src/appier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
leafs, gen_token, html_to_text, camel_to_underscore, camel_to_readable, quote, unquote,\
base_name, base_name_m, parse_cookie, parse_multipart, decode_params, load_form, check_login,\
ensure_login, private, ensure, delayed, route, error_handler, exception_handler, is_detached,\
sanitize, execute, FileTuple
sanitize, execute, FileTuple, BaseThread
from .validation import validate, validate_b, safe, eq, gt, gte, lt, lte, not_null, not_empty,\
not_false, is_in, is_simple, is_email, is_url, is_regex, field_eq, field_gt, field_gte,\
field_lt, field_lte, string_gt, string_lt, equals, not_past, not_duplicate, all_different,\
Expand Down
7 changes: 4 additions & 3 deletions src/appier/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
""" The name to be used to describe the framework while working
on its own environment, this is just a descriptive value """

VERSION = "0.9.92"
VERSION = "0.9.93"
""" The version of the framework that is currently installed
this value may be used for debugging/diagnostic purposes """

Expand Down Expand Up @@ -451,9 +451,10 @@ def serve(
if "ssl" in names: kwargs["ssl"] = ssl
if "key_file" in names: kwargs["key_file"] = key_file
if "cer_file" in names: kwargs["cer_file"] = cer_file
if threaded: threading.Thread(
if threaded: util.BaseThread(
target = self.serve_final,
args = (server, method, host, port, kwargs)
args = (server, method, host, port, kwargs),
daemon = True
).start()
else: self.serve_final(server, method, host, port, kwargs)

Expand Down
20 changes: 20 additions & 0 deletions src/appier/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import uuid
import types
import hashlib
import threading
import functools
import subprocess

Expand Down Expand Up @@ -1091,3 +1092,22 @@ def save(self, path):
file = open(path, "wb")
try: file.write(contents)
finally: file.close()

class BaseThread(threading.Thread):
"""
The top level thread class that is meant to encapsulate
a running base object and run it in a new context.
This base thread may be used to run a network loop allowing
a main thread to continue with execution logic.
"""

def __init__(self, owner, daemon = False, *args, **kwargs):
threading.Thread.__init__(self, *args, **kwargs)
self.owner = owner
self.daemon = daemon

def run(self):
threading.Thread.run(self)
self.owner.start()
self.owner = None

0 comments on commit d68def4

Please sign in to comment.