Commit 78424b40 authored by Romain Bignon's avatar Romain Bignon

init files with bullshit in

parent ecfea2e7
from .ass2m import Ass2m, WorkdirNotFound
# -*- coding: utf-8 -*-
import os
class WorkdirNotFound(Exception): pass
class Ass2m(object):
DIRNAME = '.ass2m'
def __init__(self, path):
while not self.DIRNAME in os.listdir(path) and path != os.path.dirname(path):
path = os.path.dirname(path)
if path == os.path.dirname(path):
raise WorkdirNotFound()
self.workdir = os.path.join(path, self.DIRNAME)
@classmethod
def create(cls, path):
os.mkdir(os.path.join(path, cls.DIRNAME))
return cls(path)
# -*- coding: utf-8 -*-
import sys
import os
from ass2m import Ass2m, WorkdirNotFound
class Ass2mCLI(object):
def __init__(self):
try:
self.ass2m = Ass2m(os.getcwd())
except WorkdirNotFound:
self.ass2m = None
def parse_args(self, argv):
if len(argv) < 2 or not hasattr(self, 'cmd_%s' % argv[1]):
return self.cmd_help([])
func = getattr(self, 'cmd_%s' % argv[1])
return func(argv[2:])
def cmd_help(self, args):
print 'Usage: %s cmd [args..]' % sys.argv[0]
print ''
print 'Commands:'
print ' init'
print ' share PATH [CONTACTS..]'
def cmd_share(self, args):
return
def cmd_init(self, args):
self.ass2m = Ass2m.create(os.getcwd())
print 'Ass2m working directory created.'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
import sys
from ass2m.cli import Ass2mCLI
if __name__ == '__main__':
app = Ass2mCLI()
sys.exit(app.parse_args(sys.argv))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
from flup.server.fcgi import WSGIServer
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
yield """
<html>
<head>
<title>Hello you!</title>
</head>
<body>
<h1>Hello you!</h1>
</body>
</html>"""
WSGIServer(app).run()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment