module opportunity_controller
import nitcorn
-import sha1
import templates
import opportunity_model
super OpportunityAction
redef fun answer(request, url) do
- print "Received request for {url}"
var get = request.get_args
var rq = url.split("/")
if rq.has("meetup_create") then
rsp.body = meetpage.write_to_string
return rsp
end
- if not meet.commit(db) then
+
+ var success = meet.commit(db)
+ if not success then
db.close
- var rsp = new HttpResponse(200)
+ var rsp = new HttpResponse(500)
var meetpage = new MeetupCreationPage
meetpage.meet = meet
meetpage.ans = ansset
- meetpage.error = """<p>Could not create Meetup.</p>
- <p>Hmm, that's embarassing, the database indicates that your meetup already exists.</p>
- <p>If this is not a duplicated submission, please contact the mainainers of the website, you might have found a bug !</p>"""
+ meetpage.error = """
+<p>Failed to create event</p>
+<p>This is a server side error, it has been logged.
+ You may still want to contact the maintainers of this website.</p>"""
rsp.body = meetpage.write_to_string
return rsp
end
+
for v in ansset do
var ans = new Answer(v)
ans.meetup = meet
super OpportunityAction
redef fun answer(request, uri) do
- print "Received REST request from {uri}"
var req = uri.split("/")
if req.has("people") then
return (new OpportunityPeopleREST).answer(request, uri)
if args.has("new_pers") then
var name = request.string_arg("persname")
var m_id = request.string_arg("meetup_id")
- var ans = request.string_arg("answers").split("&")
- if name == null or m_id == null then return bad_req
- print ans
+ var ans_str = request.string_arg("answers")
+ if name == null or m_id == null or ans_str == null then return bad_req
+ var ans = ans_str.split("&")
var ansmap = new HashMap[Int, Int]
for i in ans do
var mp = i.split("=")