Skip to content

Commit

Permalink
fix kwic for newer falcon API
Browse files Browse the repository at this point in the history
  • Loading branch information
liao961120 committed Nov 29, 2024
1 parent 6c70f4f commit 1dd4db1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ dist.zip
/docs/build
*_cache
/kwic/node_modules
PYPI_TOKEN.txt
6 changes: 3 additions & 3 deletions concordancer/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def on_get(self, req, resp):
cqls.parse(cql)
except:
resp.status = falcon.HTTP_400
resp.body = 'CQL Syntax error'
resp.text = 'CQL Syntax error'

# Query Database
self.concord_list = list(
Expand All @@ -147,7 +147,7 @@ def on_get(self, req, resp):
print(f"Found {len(self.concord_list)} results...\n")
############ _DEBUGGING ##############
resp.status = falcon.HTTP_200 # This is the default status
resp.body = json.dumps({
resp.text = json.dumps({
'results': self.concord_list,
'default_attr': self.C._cql_default_attr
}, ensure_ascii=False)
Expand All @@ -166,7 +166,7 @@ def on_get_export(self, req, resp):
-----
Sends the most recent queried results back to the front-end in JSON
"""
resp.body = json.dumps(self.concord_list, ensure_ascii=False, indent="\t")
resp.text = json.dumps(self.concord_list, ensure_ascii=False, indent="\t")


########################################
Expand Down
15 changes: 12 additions & 3 deletions pypi.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
python3 setup.py sdist bdist_wheel &&
twine upload dist/*
rm -r build/ dist/ concordancer.egg-info/
if [ "$OSTYPE" == "msys" ]; then
bc() {
/c/Users/rd/bin/unix/bc/bin/bc.exe "$@"
}
fi

# Build package
[[ -d build/ ]] && rm -r build/
[[ -d dist/ ]] && rm -r dist/
[[ -d nutrical.egg-info/ ]] && rm -r nutrical.egg-info/
python setup.py sdist bdist_wheel &&
twine upload --verbose --repository pypi dist/*
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = f.read().strip()

setup(name='concordancer',
version='0.1.14',
version='0.1.15',
description='Extract concordance lines from corpus with CQL',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 1dd4db1

Please sign in to comment.