def rally_create(): try: response.content_type = 'application/json' data = request.json detail = data.get('description', '') or data.get('detail', '') name = data.get('storyTitle', '') or data.get('name', '') user = data.get('username', 'unknown') except Exception as e: return {"error": repr(e)} if name == "" and detail == "": return {"error": "Not enough data!"} stuff = rally.make_story(name, detail, user) return {'storyID': stuff['FormattedID']}
def rally_story(): if request.forms.detail: detail = request.forms.detail else: detail = "" if request.forms.name: name = request.forms.name else: name = "" if name == "" and detail == "": return "Not enough data!" stuff = rally.make_story(name, detail) return """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'><head><meta http-equiv='Content-Type' content='application/xhtml+xml; charset=utf-8'/><meta name='generator' content='emacs,lisp'/> <head> <style type="text/css">body{font-family: Monospace; margin:4px;max-width:650px;line-height:0.8;font-size:16px;color:#444;padding:010px}h1,h2,h3{line-height:1.2}</style> <title>Sherlock Feature Request Experiment</title> </head><body><h1>Sherlock Feature Request Experiment</h1><pre>""" + stuff + "</pre></body></html>"
detail = data.get('description', '') or data.get('detail', '') name = data.get('storyTitle', '') or data.get('name', '') user = data.get('username', 'unknown') except Exception as e: return {"error": repr(e)} if name == "" and detail == "": return {"error": "Not enough data!"} stuff = rally.make_story(name, detail, user) return {'storyID': stuff['FormattedID']} @route('/story/:story_id', method='GET') def rally_get(story_id): try: response.content_type = 'application/json' except Exception as e: return {"error": repr(e)} story_details = rally.get_story(story_id) wrapper = {'storyID': story_id} wrapper.update(story_details) return json.dumps(wrapper) if os.uname()[0] == 'Darwin': run(host='localhost', port=8888, server='cherrypy') else: run(host=os.uname()[1], port=8888, server='cherrypy') if __name__ == "main": print rally.make_story('Unit test', "Please delete")
name = data.get('storyTitle', '') or data.get('name', '') user = data.get('username', 'unknown') except Exception as e: return {"error": repr(e)} if name == "" and detail == "": return {"error": "Not enough data!"} stuff = rally.make_story(name, detail, user) return {'storyID': stuff['FormattedID']} @route('/story/:story_id', method='GET') def rally_get(story_id): try: response.content_type = 'application/json' except Exception as e: return {"error": repr(e)} story_details = rally.get_story(story_id) wrapper = {'storyID': story_id} wrapper.update(story_details) return json.dumps(wrapper) if os.uname()[0] == 'Darwin': run(host='localhost', port=8888, server='cherrypy') else: run(host=os.uname()[1], port=8888, server='cherrypy') if __name__ == "main": print rally.make_story('Unit test', "Please delete")