chellow 1761056531.0.0__py3-none-any.whl → 1761297878.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chellow might be problematic. Click here for more details.

chellow/e/views.py CHANGED
@@ -5711,7 +5711,7 @@ def supplier_contract_edit_delete(contract_id):
5711
5711
  contract = Contract.get_supplier_by_id(g.sess, contract_id)
5712
5712
  contract.delete(g.sess)
5713
5713
  g.sess.commit()
5714
- return chellow_redirect("/supplier_contracts", 303)
5714
+ return hx_redirect("/supplier_contracts", 303)
5715
5715
  except BadRequest as e:
5716
5716
  g.sess.rollback()
5717
5717
  description = e.description
@@ -5882,25 +5882,39 @@ def supplier_rate_script_edit_get(rate_script_id):
5882
5882
  )
5883
5883
 
5884
5884
 
5885
+ @e.route("/supplier_rate_scripts/<int:rate_script_id>/edit", methods=["DELETE"])
5886
+ def supplier_rate_script_edit_delete(rate_script_id):
5887
+ try:
5888
+ rate_script = RateScript.get_supplier_by_id(g.sess, rate_script_id)
5889
+ contract = rate_script.contract
5890
+ contract.delete_rate_script(g.sess, rate_script)
5891
+ g.sess.commit()
5892
+ return hx_redirect(f"/supplier_contracts/{contract.id}", 303)
5893
+ except BadRequest as e:
5894
+ g.sess.rollback()
5895
+ flash(e.description)
5896
+ return make_response(
5897
+ render_template(
5898
+ "supplier_rate_script_edit.html", supplier_rate_script=rate_script
5899
+ ),
5900
+ 400,
5901
+ )
5902
+
5903
+
5885
5904
  @e.route("/supplier_rate_scripts/<int:rate_script_id>/edit", methods=["POST"])
5886
5905
  def supplier_rate_script_edit_post(rate_script_id):
5887
5906
  try:
5888
5907
  rate_script = RateScript.get_supplier_by_id(g.sess, rate_script_id)
5889
5908
  contract = rate_script.contract
5890
- if "delete" in request.values:
5891
- contract.delete_rate_script(g.sess, rate_script)
5892
- g.sess.commit()
5893
- return chellow_redirect(f"/supplier_contracts/{contract.id}", 303)
5894
- else:
5895
- script = req_zish("script")
5896
- start_date = req_date("start")
5897
- has_finished = req_bool("has_finished")
5898
- finish_date = req_date("finish") if has_finished else None
5899
- contract.update_rate_script(
5900
- g.sess, rate_script, start_date, finish_date, script
5901
- )
5902
- g.sess.commit()
5903
- return chellow_redirect(f"/supplier_rate_scripts/{rate_script.id}", 303)
5909
+ script = req_zish("script")
5910
+ start_date = req_date("start")
5911
+ has_finished = req_bool("has_finished")
5912
+ finish_date = req_date("finish") if has_finished else None
5913
+ contract.update_rate_script(
5914
+ g.sess, rate_script, start_date, finish_date, script
5915
+ )
5916
+ g.sess.commit()
5917
+ return chellow_redirect(f"/supplier_rate_scripts/{rate_script.id}", 303)
5904
5918
  except BadRequest as e:
5905
5919
  g.sess.rollback()
5906
5920
  flash(e.description)
@@ -5,7 +5,7 @@ import traceback
5
5
 
6
6
  from dateutil.relativedelta import relativedelta
7
7
 
8
- from flask import g, redirect, render_template
8
+ from flask import g, redirect, render_template, request
9
9
 
10
10
  from sqlalchemy.orm import joinedload
11
11
  from sqlalchemy.sql.expression import false, select, true
@@ -29,6 +29,7 @@ from chellow.utils import (
29
29
  csv_make_val,
30
30
  hh_before,
31
31
  req_bool,
32
+ req_date,
32
33
  req_int,
33
34
  req_int_none,
34
35
  req_str,
@@ -160,6 +161,7 @@ def content(
160
161
  only_ongoing,
161
162
  show_settlement,
162
163
  days_long_hidden,
164
+ now,
163
165
  ):
164
166
  f = writer = None
165
167
  try:
@@ -192,7 +194,6 @@ def content(
192
194
  )
193
195
  writer.writerow(titles)
194
196
 
195
- now = utc_datetime_now()
196
197
  for snag_group in _make_rows(
197
198
  sess,
198
199
  now,
@@ -246,6 +247,10 @@ def do_get(sess):
246
247
  show_settlement = req_str("show_settlement")
247
248
  as_csv = req_bool("as_csv")
248
249
  days_long_hidden = req_int_none("days_long_hidden")
250
+ if "now_year" in request.values:
251
+ now = req_date("now")
252
+ else:
253
+ now = utc_datetime_now()
249
254
 
250
255
  if as_csv:
251
256
  args = (
@@ -255,6 +260,7 @@ def do_get(sess):
255
260
  g.user.id,
256
261
  only_ongoing,
257
262
  show_settlement,
263
+ now,
258
264
  )
259
265
  threading.Thread(target=content, args=args).start()
260
266
  return redirect("/downloads", 303)
@@ -12,41 +12,29 @@
12
12
 
13
13
  {% block content %}
14
14
 
15
- {% if request.method == 'GET' and request.values.delete %}
16
- <form method="post">
17
- <fieldset>
18
- <legend>Are you sure you want to delete this contract?</legend>
19
- <input type="submit" name="delete" value="Delete">
20
- <a href="/e/supplier_contracts/{{contract.id}}/edit">Cancel</a>
21
- </fieldset>
22
- </form>
23
-
24
- {% else %}
25
-
26
- <form method="post">
27
- <fieldset>
28
- <legend>Update Contract</legend>
29
- <label>Party</label>
30
- <select name="party_id">
31
- {% for party in parties %}
32
- {{ input_option('party_id', party.id, party.participant.code + ' : ' + party.name, contract.party.id) }}
33
- {% endfor %}
34
- </select>
35
- <label>Name</label>
36
- {{input_text('name', contract.name)}}
37
- <label>Charge script</label>
38
- {{input_textarea('charge_script', contract.charge_script, 40, 80)}}
39
- <label>Properties</label>
40
- {{input_textarea('properties', contract.properties, 20, 80)}}
41
- <input type="submit" value="Update">
42
- </fieldset>
43
- </form>
15
+ <form method="post">
16
+ <fieldset>
17
+ <legend>Update Contract</legend>
18
+ <label>Party</label>
19
+ <select name="party_id">
20
+ {% for party in parties %}
21
+ {{ input_option('party_id', party.id, party.participant.code + ' : ' + party.name, contract.party.id) }}
22
+ {% endfor %}
23
+ </select>
24
+ <label>Name</label>
25
+ {{input_text('name', contract.name)}}
26
+ <label>Charge script</label>
27
+ {{input_textarea('charge_script', contract.charge_script, 40, 80, show_pos=True)}}
28
+ <label>Properties</label>
29
+ {{input_textarea('properties', contract.properties, 20, 80)}}
30
+ <input type="submit" value="Update">
31
+ </fieldset>
32
+ </form>
44
33
 
45
- <form>
46
- <fieldset>
47
- <legend>Delete this contract</legend>
48
- <input type="submit" name="delete" value="Delete">
49
- </fieldset>
50
- </form>
51
- {% endif %}
34
+ <form hx-delete="/e/supplier_contracts/{{contract.id}}/edit" hx-confirm="Are you sure you want to delete this contract?">
35
+ <fieldset>
36
+ <legend>Delete this contract</legend>
37
+ <input type="submit" name="delete" value="Delete">
38
+ </fieldset>
39
+ </form>
52
40
  {% endblock %}
@@ -14,52 +14,37 @@
14
14
  {% endblock %}
15
15
 
16
16
  {% block content %}
17
- {% if request.method == 'GET' and request.values.delete %}
18
-
19
- <form method="post"
20
- action="/e/supplier_rate_scripts/{{supplier_rate_script.id}}/edit">
21
- <fieldset>
22
- <legend>Are you sure you want to delete this rate script?</legend>
23
- <input type="submit" name="delete" value="Delete">
24
- <a href="/supplier_rate_scripts/{{supplier_rate_script.id}}/edit">Cancel</a>
25
- </fieldset>
26
- </form>
27
-
28
- {% else %}
29
-
30
- <form action="" method="post">
17
+ <form action="/e/supplier_rate_scripts/{{supplier_rate_script.id}}/edit" method="post">
18
+ <fieldset>
19
+ <legend>Update Rate Script</legend>
31
20
  <fieldset>
32
- <legend>Update Rate Script</legend>
33
- <fieldset>
34
- <legend>Start date</legend>
35
- {{ input_date('start', supplier_rate_script.start_date) }}
36
- </fieldset>
37
- <fieldset>
38
- <legend>Finish date</legend>
39
- <label>
40
- Ended?
41
- {{input_checkbox('has_finished', supplier_rate_script.finish_date != None)}}
42
- </label>
43
- {{ input_date('finish', supplier_rate_script.finish_date) }}
44
- </fieldset>
45
- <label>Script</label>
46
- {{ input_textarea(
47
- 'script', supplier_rate_script.script, 40, 80, show_pos=True) }}
48
- <input type="submit" value="Update">
21
+ <legend>Start date</legend>
22
+ {{ input_date('start', supplier_rate_script.start_date) }}
49
23
  </fieldset>
50
- </form>
51
-
52
- {% if rate_script_example %}
53
- <h4>Example</h4>
54
- <pre>{{rate_script_example}}</pre>
55
- {% endif %}
56
-
57
- <form>
58
24
  <fieldset>
59
- <legend>Delete this Rate Script</legend>
60
- <input type="submit" name="delete" value="Delete">
25
+ <legend>Finish date</legend>
26
+ <label>
27
+ Ended?
28
+ {{input_checkbox('has_finished', supplier_rate_script.finish_date != None)}}
29
+ </label>
30
+ {{ input_date('finish', supplier_rate_script.finish_date) }}
61
31
  </fieldset>
62
- </form>
63
-
32
+ <label>Script</label>
33
+ {{ input_textarea(
34
+ 'script', supplier_rate_script.script, 40, 80, show_pos=True) }}
35
+ <input type="submit" value="Update">
36
+ </fieldset>
37
+ </form>
38
+
39
+ {% if rate_script_example %}
40
+ <h4>Example</h4>
41
+ <pre>{{rate_script_example}}</pre>
64
42
  {% endif %}
43
+
44
+ <form hx-delete="/e/supplier_rate_scripts/{{supplier_rate_script.id}}/edit" hx-confirm="Are you sure you want to delete this rate script?">
45
+ <fieldset>
46
+ <legend>Delete this Rate Script</legend>
47
+ <input type="submit" name="delete" value="Delete">
48
+ </fieldset>
49
+ </form>
65
50
  {% endblock %}
@@ -1,30 +1,28 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chellow
3
- Version: 1761056531.0.0
3
+ Version: 1761297878.0.0
4
4
  Summary: Web Application for checking UK energy bills.
5
5
  Project-URL: Homepage, https://github.com/WessexWater/chellow
6
6
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
7
7
  Classifier: Operating System :: OS Independent
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Requires-Python: >=3.11
10
- Requires-Dist: flask-restx==1.3.0
11
- Requires-Dist: flask==3.1.1
12
- Requires-Dist: jsonschema==4.17.3
10
+ Requires-Dist: flask-restx==1.3.2
11
+ Requires-Dist: flask==3.1.2
13
12
  Requires-Dist: odio==0.0.23
14
13
  Requires-Dist: openpyxl==3.1.5
15
- Requires-Dist: paramiko==3.4.1
16
- Requires-Dist: pep3143daemon==0.1.0
14
+ Requires-Dist: paramiko==4.0.0
17
15
  Requires-Dist: pg8000==1.31.5
18
16
  Requires-Dist: pip>=9.0.1
19
- Requires-Dist: psutil==5.9.5
20
- Requires-Dist: pympler==1.0.1
21
- Requires-Dist: pypdf==6.0.0
17
+ Requires-Dist: psutil==7.1.1
18
+ Requires-Dist: pympler==1.1
19
+ Requires-Dist: pypdf==6.1.3
22
20
  Requires-Dist: python-dateutil==2.8.2
23
- Requires-Dist: pytz==2022.6
24
- Requires-Dist: requests==2.32.4
25
- Requires-Dist: sqlalchemy==2.0.41
26
- Requires-Dist: waitress==3.0.1
27
- Requires-Dist: xlrd==2.0.1
21
+ Requires-Dist: pytz==2025.2
22
+ Requires-Dist: requests==2.32.5
23
+ Requires-Dist: sqlalchemy==2.0.44
24
+ Requires-Dist: waitress==3.0.2
25
+ Requires-Dist: xlrd==2.0.2
28
26
  Requires-Dist: zish==0.1.12
29
27
  Description-Content-Type: text/markdown
30
28
 
@@ -1,7 +1,6 @@
1
1
  chellow/__init__.py,sha256=9aoSbGmHCIHwzI_c_TLSg5CeKwqAq0I6kKaMvTrTMqg,10936
2
2
  chellow/api.py,sha256=mk17TfweR76DPFC8lX2SArTjai6y6YshASxqO1w-_-s,11036
3
3
  chellow/bank_holidays.py,sha256=T_utYMwe_g1dz5X-aOTdIPryg49SvB7QsWM1yphlqG8,4423
4
- chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
5
4
  chellow/dloads.py,sha256=sNAPMe4LeHqfisEubGXvraDsUS0F-ujI3WG0Md8DywM,5565
6
5
  chellow/edi_lib.py,sha256=Lq70TUJuogoP5KGrphzUEUfyfgftEclg_iA3mpNAaDI,51324
7
6
  chellow/fake_batch_updater.py,sha256=khAmvSUn9qN04w8C92kRg1UeyQvfLztE7QXv9tUz6nE,11611
@@ -45,7 +44,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
45
44
  chellow/e/tlms.py,sha256=pyL32hPiYd09FbpXVMnBjHsWFEQHs-Az945V7EShGiY,9116
46
45
  chellow/e/tnuos.py,sha256=NBmc-f3oezrl4gviAKobljHfICTpBKxxxEGBGJi_lRk,4927
47
46
  chellow/e/triad.py,sha256=uQIngSrz8irBXQ0Rp_s8nAUzu-y2Ms7aj4B38_Ff8y8,13720
48
- chellow/e/views.py,sha256=7WKLrqYtk018oXjmx9YBv72B5hpgOV0eTJYqsIoBYsE,234251
47
+ chellow/e/views.py,sha256=Duvdp5ZjtCHnOrAyk7uZZJr0jZcg0F2h3g1XNN25HtU,234669
49
48
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
49
  chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=hcbjxqLOe7qkDjS7enCpmfyGwm3d-pq3u5VQIaUmVTw,3796
51
50
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=yoEGQS0qcrv3TWFfxELIIi8f1CyKcIzh0xVaPoz2w2s,4191
@@ -100,7 +99,7 @@ chellow/reports/report_87.py,sha256=udzbCuXcckWD-OHmfJCT6bwg_paYhm4vfDWlL8WM-jA,
100
99
  chellow/reports/report_asset_comparison.py,sha256=Cl2NgvbclqhOVvKuUu3sajTVO2JupMfzK3bV0_K8eNs,6077
101
100
  chellow/reports/report_batches.py,sha256=MoCv2dE-JgaJzaMjMA-kZrPkYR13uDoXer5UuF12OYc,4757
102
101
  chellow/reports/report_bills.py,sha256=LP7XDxzO0Fp10c8xDE67e4tHTEc7nN74ESQBy762Nx4,3401
103
- chellow/reports/report_channel_snags.py,sha256=RV5L3zRwFmuZws7w9H9VzLCFlQ6U3-ZU6jn4j5VydNc,8626
102
+ chellow/reports/report_channel_snags.py,sha256=qBVmw0q588izKJr6dDOn7jjdFvSa-Ldd2uqtVETqijY,8748
104
103
  chellow/reports/report_csv_llfcs.py,sha256=mMB06b6Jems5kcQU4H4Le_fyKgVr8THP8BCx3pkvg5E,1903
105
104
  chellow/reports/report_csv_site_hh_data.py,sha256=ik0OkGVo1bfTXLdcT3gPUHnxSkSdorzZheP3qgnOR5c,4331
106
105
  chellow/reports/report_csv_site_snags.py,sha256=AuAy6vjL0g7vwPPAZhBqxOyITL9_jnyFj012MnUcxxk,2627
@@ -336,14 +335,14 @@ chellow/templates/e/supplier_bill_import.html,sha256=RXvRkKoH-s1F_Wz---WygiNCmAm
336
335
  chellow/templates/e/supplier_bill_import_contract.html,sha256=HySas6Q-1Pi6aZaEZNhKeK4c3d8MFbBIMh0PJ4zvKWQ,3117
337
336
  chellow/templates/e/supplier_contract.html,sha256=jz3_2q5HuJaxQhJPaM_dcukigYyI6UmhVYC6nPHY7Ng,3243
338
337
  chellow/templates/e/supplier_contract_add.html,sha256=gsozEtF24lzYi_Bb4LTenvh62tCt7dQ4CwaIz7rFck4,899
339
- chellow/templates/e/supplier_contract_edit.html,sha256=Afwtn0l8XRbt86bMOru2AjjvctoUkieD052aY0B2mDc,1463
338
+ chellow/templates/e/supplier_contract_edit.html,sha256=PciQ91n1PB2-Z8vK4HIRiAc4tH3zwV17tnA-T6sRJu0,1226
340
339
  chellow/templates/e/supplier_contracts.html,sha256=VwWD4q88Fynz7vioFSAsyH6RR_1SyQQl6bQwzL-W1m0,1508
341
340
  chellow/templates/e/supplier_element.html,sha256=XQXvSVFISC3ZwCRurfpZbppFJgMhzbhqcwDYFT50bok,1370
342
341
  chellow/templates/e/supplier_element_add.html,sha256=gSdn3X2BPUclPwbsuvQC-yIejaLykKFhJl_sC1kLB4s,1220
343
342
  chellow/templates/e/supplier_element_edit.html,sha256=NrW51twKITht7w4qi8xrxivU3h-jcGpYySBuxq-L5XU,1846
344
343
  chellow/templates/e/supplier_rate_script.html,sha256=tjWeCUAgNip3VLHzbXqe19Msiasys3Wm5Vra936qJjI,1245
345
344
  chellow/templates/e/supplier_rate_script_add.html,sha256=Yf2LZEIHbL7qT6oxBCtPf0ZX7vJsSo_ZeOKJhJoVh3o,690
346
- chellow/templates/e/supplier_rate_script_edit.html,sha256=VaYJt8nxHdnuP-zEAuBJC-ibEpjDU1b80hXtdBQH1dg,1968
345
+ chellow/templates/e/supplier_rate_script_edit.html,sha256=Nt2bg78DCXiQpl2SAxIWjJx2nqljOtcqKVDkUnmO9_k,1695
347
346
  chellow/templates/e/supply.html,sha256=kFyYPIzMgRZz7tHY_TfmjYzUkc1zXyaJses6X372Ozg,8427
348
347
  chellow/templates/e/supply_edit.html,sha256=2BRGU35nb0ZpUHKCi_fgAPMU6SlHI7ve3_Ne8LXHtms,2333
349
348
  chellow/templates/e/supply_eras.html,sha256=5lB7_oC-sTWRQoASuPgBWj5XSZa9ajR0s6V6xKHvf6E,19996
@@ -401,6 +400,6 @@ chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBe
401
400
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
402
401
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
403
402
  chellow/templates/reports/channel_snags.html,sha256=_aAgFgMlTkK2HuKFU8YisAIcUYfg6Hqhgyf5MZpdK8c,2629
404
- chellow-1761056531.0.0.dist-info/METADATA,sha256=x465BtJg_0nCB84ep2IVjHyEpTTyZZixgcyJ_zKU7fk,12500
405
- chellow-1761056531.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
406
- chellow-1761056531.0.0.dist-info/RECORD,,
403
+ chellow-1761297878.0.0.dist-info/METADATA,sha256=YJWJBO0S9POBAD-RG5IFnGyCsyecRLSoNm_xWroFfrw,12428
404
+ chellow-1761297878.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
405
+ chellow-1761297878.0.0.dist-info/RECORD,,
chellow/commands.py DELETED
@@ -1,52 +0,0 @@
1
- import argparse
2
- import os.path
3
- import signal
4
- import sys
5
- import time
6
- from os import environ
7
-
8
- from pep3143daemon import DaemonContext, PidFile
9
-
10
- import waitress
11
-
12
- from chellow import create_app
13
-
14
- app = create_app()
15
-
16
-
17
- def chellow_start(daemon):
18
- chellow_port = environ["CHELLOW_PORT"] if "CHELLOW_PORT" in environ else 80
19
- daemon.open()
20
- waitress.serve(app, host="0.0.0.0", port=chellow_port)
21
-
22
-
23
- def chellow_stop(pidfile_path):
24
- with open(pidfile_path) as pidfile:
25
- pid = int(pidfile.read())
26
- os.kill(pid, signal.SIGTERM)
27
- while os.path.exists(pidfile_path):
28
- time.sleep(1)
29
-
30
-
31
- def chellow_command():
32
- parser = argparse.ArgumentParser()
33
- parser.add_argument("action", choices=["start", "stop", "restart"])
34
- args = parser.parse_args()
35
-
36
- try:
37
- os.makedirs(app.instance_path)
38
- except BaseException:
39
- pass
40
- pidfile_path = os.path.join(app.instance_path, "chellow.pid")
41
- pidfile = PidFile(pidfile_path)
42
- daemon = DaemonContext(
43
- pidfile=pidfile, stdin=sys.stdin, stderr=sys.stderr, stdout=sys.stdout
44
- )
45
-
46
- if args.action == "start":
47
- chellow_start(daemon)
48
- elif args.action == "stop":
49
- chellow_stop(pidfile_path)
50
- elif args.action == "restart":
51
- chellow_stop(pidfile_path)
52
- chellow_start(daemon)