# -*- coding: utf-8 -*- import sys sys.path.append('./vendor') sys.path.append('./lib') import juno juno.init() from controller import session, signup, main #from controller import message, follow #from controller import test_user # juno.run_with_profiler() juno.run()
#!/usr/bin/env python3 import re import os import os.path as ospath from sys import stdout from copy import deepcopy from optparse import OptionParser from subprocess import getoutput, getstatusoutput from inc.cwebparser import load_podcast_file, \ load_recording_file, \ get_category, flatten_files from juno import init, session init({'use_db': True, 'db_location': "db.sqlite" }) from inc.db import File, Link, Episode, Comment, Rating, Preview,\ ShownoteTrackback from inc.trackback import trackback_client from inc.progressbar import Progressbar from inc.console import style, drug from config import pentamediaportal, \ cwebgitrepository, codetuberepository, \ cwebnewsfolder from blacklist import sites as blacklist re_news = re.compile(r"(?P<status>M|A|D)\s*(?P<file>"+cwebnewsfolder+r"((penta(cast|music|radio))|(d(s|atenspuren))).*\.xml)") gitcmd = "git --git-dir=cweb.git --work-tree=. "
# does what you need for the test, and then the # original test function checks the return value. # # URL numbers correspond to the order of test cases. # # See existing tests. # # # # # # # # # """ ---------------------- """ """ Start Application Code """ """ ---------------------- """ import juno juno.init({'use_db': False, 'mode': 'wsgi', 'log': False, 'use_static': False, 'use_templates': False}) @juno.get('/1/') def x1(web): return @juno.get('/2/') def x2(web): juno.status(404) @juno.get('/3/') def x3(web): juno.status(500) @juno.get('/4/') def x4(web): return @juno.get('/5/') def x5(web): juno.content_type('text/json')
# # URL numbers correspond to the order of test cases. # # See existing tests. # # # # # # # # # """ ---------------------- """ """ Start Application Code """ """ ---------------------- """ import juno juno.init({ 'use_db': False, 'mode': 'wsgi', 'log': False, 'use_static': False, 'use_templates': False }) @juno.get('/1/') def x1(web): return @juno.get('/2/') def x2(web): juno.status(404)
def __init__(self): self.app = init({"use_templates": True, "use_db": False, "dev_port": config.port}) self.app.config["template_env"].filters["basename"] = os.path.basename self.app.config["template_env"].filters["as_age"] = as_age self.app.config["template_env"].filters["duration"] = duration @get(["/", "/today"]) def today(web): rtorrent = RTorrent() torrents, history = rtorrent.today() template( "index.tpl", torrents=torrents, queue=rtorrent.get_queue(), history=history, status=rtorrent.get_status(), ) @get("/archives") def archives(web): rtorrent = RTorrent() template("index.tpl", history=rtorrent.archives(), status=rtorrent.get_status()) def as_json(val): return json.dumps(val, sort_keys=True, indent=2, cls=Encoder) @get("/json/today") def json_today(web): rtorrent = RTorrent() torrents, history = rtorrent.today() return as_json({"torrents": torrents, "history": history}) @get("/json/status") def json_queue(web): return as_json(RTorrent().get_status()) @get("/json/queue") def json_queue(web): return as_json([t.as_dict() for t in RTorrent().get_queue()]) @get("/json/archives") def json_archives(web): return as_json(RTorrent().archives()) @get("/pause/:tid") def pause_torrent(web, tid): RTorrent().pause(tid) redirect("/") @get("/resume/:tid") def resume_torrent(web, tid): RTorrent().resume(tid) redirect("/") @get("/remove/:tid") def remove_torrent(web, tid): RTorrent().safe_erase_torrent(tid) redirect("/") @get("/reload/:filename") def reload_torrent(web, filename): RTorrent().reload(filename) redirect("/") @get("/push/:filename") def push_torrent(web, filename): RTorrent().push(filename) redirect("/") @get("/queue/:filename") def queue_torrent(web, filename): RTorrent().queue(filename) redirect("/") @get("/restart") def restart(web): RTorrent().restart() redirect("/") @get("/favicon.ico") def favicon(web): redirect("/static/favicon.ico")
#!/usr/bin/env python3.0 from juno import init, run init({'static_url': '/(s/)?(?P<file>(?<=s/).*|(css|img|js|lib)/.*)', '500_traceback': True, 'use_templates': True, 'bind_address': '', 'use_db': True, 'db_location': "db.sqlite", 'template_kwargs': {'extensions': ["jinja2.ext.do","jinja2.ext.loopcontrols"]} }) import inc.routes run()