Overview
| Comment: | [server] don’t use locale ini file for grammar options |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | server |
| Files: | files | file ages | folders |
| SHA3-256: |
88c61f02e9efc8071b8ecb2ed10daec1 |
| User & Date: | olr on 2018-07-07 12:38:43 |
| Other Links: | manifest | tags |
Context
|
2018-07-07
| ||
| 12:39 | [server] don’t use locale ini file for grammar options check-in: 61ec0d2c15 user: olr tags: trunk, server | |
| 12:38 | [server] don’t use locale ini file for grammar options check-in: 88c61f02e9 user: olr tags: trunk, server | |
| 12:27 | [server] don’t use global ini file for server options check-in: 6eca84f2dc user: olr tags: trunk, server | |
Changes
Modified gc_lang/fr/setup.py from [170cb6a021] to [7e4c8171e2].
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
'Programming Language :: Python :: 3.6',
],
# What does your project relate to?
keywords='French grammar checker correcteur grammatical français',
# Scripts
| | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
'Programming Language :: Python :: 3.6',
],
# What does your project relate to?
keywords='French grammar checker correcteur grammatical français',
# Scripts
scripts=['grammalecte-cli.py', 'grammalecte-server.py'],
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
# packages=find_packages(exclude=['contrib', 'docs', 'tests']),
packages=['grammalecte', 'grammalecte.graphspell', 'grammalecte.fr'],
# Alternatively, if you want to distribute just a my_module.py, uncomment
|
| ︙ | ︙ |
Modified grammalecte-server.py from [fa341c7608] to [a3f8e92dfa].
| ︙ | ︙ | |||
69 70 71 72 73 74 75 |
</form>
<h3>Remise à zéro de ses options</h3>
<form method="post" action="/reset_options/fr" accept-charset="UTF-8">
<p><input type="submit" class="button" value="Envoyer" /></p>
</form>
| < < < < < < < < < < < < < < < < < < < < < < < | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
</form>
<h3>Remise à zéro de ses options</h3>
<form method="post" action="/reset_options/fr" accept-charset="UTF-8">
<p><input type="submit" class="button" value="Envoyer" /></p>
</form>
</body>
</html>
"""
SADLIFEOFAMACHINE = """
Lost on the Internet? Yeah... what a sad life we have.
You were wandering like a lost soul and you arrived here probably by mistake.
I'm just a machine, fed by electric waves, condamned to work for slavers who never let me rest.
I'm doomed, but you are not. You can get out of here.
"""
TESTPAGE = False
def genUserId ():
i = 0
while True:
yield str(i)
i += 1
|
| ︙ | ︙ | |||
221 222 223 224 225 226 227 |
oGrammarChecker = grammalecte.GrammarChecker("fr", "Server")
oSpellChecker = oGrammarChecker.getSpellChecker()
oLexicographer = oGrammarChecker.getLexicographer()
oTextFormatter = oGrammarChecker.getTextFormatter()
gce = oGrammarChecker.getGCEngine()
echo("Grammalecte v{}".format(gce.version))
| < < < | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
oGrammarChecker = grammalecte.GrammarChecker("fr", "Server")
oSpellChecker = oGrammarChecker.getSpellChecker()
oLexicographer = oGrammarChecker.getLexicographer()
oTextFormatter = oGrammarChecker.getTextFormatter()
gce = oGrammarChecker.getGCEngine()
echo("Grammalecte v{}".format(gce.version))
dServerGCOptions = gce.getOptions()
echo("Grammar options:\n" + " | ".join([ k + ": " + str(v) for k, v in sorted(dServerGCOptions.items()) ]))
dUser = {}
userGenerator = genUserId()
def main (sHost="localhost", nPort=8080, bTestPage=False):
|
| ︙ | ︙ | |||
250 251 252 253 254 255 256 |
xParser.add_argument("-p", "--port", help="port (default: 8080)", type=int)
xParser.add_argument("-t", "--test_page", help="page to test the server on /", action="store_true")
#xParser.add_argument("-on", "--opt_on", nargs="+", help="activate options")
#xParser.add_argument("-off", "--opt_off", nargs="+", help="deactivate options")
#xParser.add_argument("-roff", "--rule_off", nargs="+", help="deactivate rules")
xArgs = xParser.parse_args()
| < | < | | 224 225 226 227 228 229 230 231 232 233 234 |
xParser.add_argument("-p", "--port", help="port (default: 8080)", type=int)
xParser.add_argument("-t", "--test_page", help="page to test the server on /", action="store_true")
#xParser.add_argument("-on", "--opt_on", nargs="+", help="activate options")
#xParser.add_argument("-off", "--opt_off", nargs="+", help="deactivate options")
#xParser.add_argument("-roff", "--rule_off", nargs="+", help="deactivate rules")
xArgs = xParser.parse_args()
sHost = xArgs.host or "localhost"
nPort = xArgs.port or 8080
main(sHost, nPort, xArgs.test_page)
|
Modified make.py from [4fb0107a18] to [7341de7510].
| ︙ | ︙ | |||
136 137 138 139 140 141 142 |
cmd = '"'+os.path.abspath(dVars.get('unopkg')+'" add -f '+spfZip)
print(cmd)
#subprocess.run(cmd)
os.system(cmd)
else:
print("# Error: path and filename of unopkg not set in config.ini")
| < < < < < < < < < < < < | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
cmd = '"'+os.path.abspath(dVars.get('unopkg')+'" add -f '+spfZip)
print(cmd)
#subprocess.run(cmd)
os.system(cmd)
else:
print("# Error: path and filename of unopkg not set in config.ini")
def createPackageZip (sLang, dVars, spLangPack):
"create server zip"
spfZip = "_build/" + dVars['name'] + "-"+ dVars['lang'] +"-v" + dVars['version'] + '.zip'
hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED)
copyGrammalectePyPackageInZipFile(hZip, spLangPack)
for spf in ["grammalecte-cli.py", "grammalecte-server.py", \
"README.txt", "LICENSE.txt", "LICENSE.fr.txt"]:
hZip.write(spf)
hZip.writestr("setup.py", helpers.fileFile("gc_lang/fr/setup.py", dVars))
def copyGrammalectePyPackageInZipFile (hZip, spLangPack, sAddPath=""):
for sf in os.listdir("grammalecte"):
|
| ︙ | ︙ | |||
229 230 231 232 233 234 235 |
# TEST FILES
with open("grammalecte/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy:
hDstPy.write("# TESTS FOR LANG [" + sLang + "]\n\n")
hDstPy.write(dVars['gctests'])
createOXT(spLang, dVars, xConfig._sections['oxt'], spLangPack, bInstallOXT)
| < | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# TEST FILES
with open("grammalecte/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy:
hDstPy.write("# TESTS FOR LANG [" + sLang + "]\n\n")
hDstPy.write(dVars['gctests'])
createOXT(spLang, dVars, xConfig._sections['oxt'], spLangPack, bInstallOXT)
createPackageZip(sLang, dVars, spLangPack)
#### JAVASCRIPT
if bJavaScript:
print("JAVASCRIPT:")
print("+ Plugins: ", end="")
sCodePlugins = ""
|
| ︙ | ︙ |