Merge pull request #6 from ChrisTruncer/server_template

Slight modification of existing templates, and created a blank server te...
resolved_file
ChrisTruncer 2014-12-25 12:17:01 -05:00
commit 7de58f864d
4 changed files with 34 additions and 1 deletions

View File

@ -38,7 +38,7 @@ class Conductor:
pass
elif name.endswith(".pyc"):
pass
else:
elif name.endswith(".py"):
loaded_server_proto = imp.load_source(name.replace("/", ".").rstrip('.py'), name)
self.server_protocols[name] = loaded_server_proto.Server(command_line_object)
return

View File

@ -26,6 +26,7 @@ class Server:
# handle keyboard interrupts
except KeyboardInterrupt:
print "[!] Rage quiting, and stopping the web server!"
return
def serve_on_port(self):
try:

View File

@ -28,6 +28,7 @@ class Server:
# handle keyboard interrupts
except KeyboardInterrupt:
print "[!] Rage quiting, and stopping the web server!"
return
def serve_on_port(self):
try:

View File

@ -0,0 +1,31 @@
'''
A brief description of the server module can be placed up here
All import should go between the comments and class declaration
If you have a question, feel free to check out the other server
modules ot just hit me up.
Finally, be sure to rename this to a .py file
'''
class Server:
def __init__(self, cli_object):
# This is the protocol that is viewable when using --list-servers
# This is what the user would use along with --server
# You have complete access to command line arguments
# within __init__
# Anything that needs to be set for the server to run should have
# a self attribute created within __init__
self.protocol = ""
# This is the main function that is called by the framework
# You can build out as many different functions, but they all
# need to be called from "serve". If there is a specific function
# or class that must be seperated out from this file (ideally keep
# everything in here if possible), then add them to the serverlibs
# directory
def serve(self):
return