Skip to content

Commit

Permalink
FLAT had a minor HTTP violation in communication with foliadocserve (…
Browse files Browse the repository at this point in the history
…and foliadocserve's backend cherrypy got stricter), fixed
  • Loading branch information
proycon committed Oct 2, 2017
1 parent f91f8d7 commit a9e078d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.7.6"
VERSION = "0.7.7"
3 changes: 3 additions & 0 deletions flat/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def query(request, query, parsejson=True, **extradata):


def get( request, url, parsejson=True):
if url and url[0] == '/': url = url[1:]
docservereq = Request("http://" + settings.FOLIADOCSERVE_HOST + ":" + str(settings.FOLIADOCSERVE_PORT) + "/" + url) #or opener.open()
setsid(docservereq, getsid(request))
f = urlopen(docservereq)
Expand Down Expand Up @@ -130,6 +131,7 @@ def filemanagement(request, filemanmode, namespace, doc, **data):
def postjson( request, url, data):
if isinstance(data, dict) or isinstance(data,list) or isinstance(data, tuple):
data = json.dumps(data)
if url and url[0] == '/': url = url[1:]
docservereq = Request("http://" + settings.FOLIADOCSERVE_HOST + ":" + str(settings.FOLIADOCSERVE_PORT) + "/" + url + '/' + sid) #or opener.open()
setsid(docservereq, getsid(request))
docservereq.add_header('Content-Type', 'application/json')
Expand Down Expand Up @@ -170,6 +172,7 @@ def postxml( request, url, f):
#contents = f.read()
#f.close()

if url and url[0] == '/': url = url[1:]
response = requests.post("http://" + settings.FOLIADOCSERVE_HOST + ":" + str(settings.FOLIADOCSERVE_PORT) + "/" + url, data=f, headers={'Content-Type':'application/xml; charset=utf-8'})
contents = response.text
if contents and contents[0] == '{':
Expand Down
1 change: 1 addition & 0 deletions flat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def getbody(html):

def docserveerror(e, d=None):
if d is None: d={}
raise e
if isinstance(e, HTTPError):
body = getbody(e.read())
d['fatalerror'] = "<strong>Fatal Error:</strong> The document server returned an error<pre style=\"font-weight: bold\">" + str(e) + "</pre><pre>" + body +"</pre>"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def read(fname):

setup(
name = "FoLiA-Linguistic-Annotation-Tool",
version = "0.7.6", #Also change in flat/__init__.py !!
version = "0.7.7", #Also change in flat/__init__.py !!
author = "Maarten van Gompel",
author_email = "proycon@anaproy.nl",
description = ("FLAT is a web-based linguistic annotation environment based around the FoLiA format (https://proycon.github.io/folia), a rich XML-based format for linguistic annotation. Flat allows users to view annotated FoLiA documents and enrich these documents with new annotations, a wide variety of linguistic annotation types is supported through the FoLiA paradigm."),
Expand Down

0 comments on commit a9e078d

Please sign in to comment.