chellow 1692616986.0.0__py3-none-any.whl → 1692867503.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/models.py CHANGED
@@ -932,23 +932,19 @@ class Batch(Base, PersistentClass):
932
932
 
933
933
  def __init__(self, sess, contract, reference, description):
934
934
  self.contract = contract
935
- self.update(sess, reference, description)
935
+ self._update(sess, reference, description)
936
936
 
937
- def update(self, sess, reference, description):
937
+ def _update(self, sess, reference, description):
938
938
  reference = reference.strip()
939
939
  if len(reference) == 0:
940
940
  raise BadRequest("The batch reference can't be blank.")
941
941
 
942
942
  self.reference = reference
943
943
  self.description = description.strip()
944
- try:
945
- sess.flush()
946
- except SQLAlchemyError:
947
- sess.rollback()
948
- raise BadRequest(
949
- f"There's already a batch attached to the contract "
950
- f"{self.contract.name} with the reference {reference}."
951
- )
944
+
945
+ def update(self, sess, reference, description):
946
+ self._update(sess, reference, description)
947
+ sess.flush()
952
948
 
953
949
  def delete(self, sess):
954
950
  sess.execute(delete(Bill).where(Bill.batch == self))
@@ -5289,25 +5285,13 @@ class GEra(Base, PersistentClass):
5289
5285
  self.account = account
5290
5286
  self.g_reading_frequency = g_reading_frequency
5291
5287
 
5292
- if g_contract.start_g_rate_script.start_date > start_date:
5293
- raise BadRequest("The contract starts after the era.")
5288
+ with sess.no_autoflush:
5289
+ if g_contract.start_g_rate_script.start_date > start_date:
5290
+ raise BadRequest("The contract starts after the era.")
5294
5291
 
5295
5292
  if hh_before(g_contract.finish_g_rate_script.finish_date, finish_date):
5296
5293
  raise BadRequest("The contract finishes before the era.")
5297
5294
 
5298
- try:
5299
- sess.flush()
5300
- except ProgrammingError as e:
5301
- if (
5302
- e.orig.args[2]
5303
- == 'null value in column "start_date" ' + "violates not-null constraint"
5304
- ):
5305
- raise BadRequest("The start date cannot be blank.")
5306
- else:
5307
- raise e
5308
-
5309
- sess.flush()
5310
-
5311
5295
  def set_physical_location(self, sess, site):
5312
5296
  target_ssgen = (
5313
5297
  sess.query(SiteGEra)
@@ -5435,7 +5419,6 @@ class GSupply(Base, PersistentClass):
5435
5419
 
5436
5420
  finish_date = covered_g_era.finish_date
5437
5421
 
5438
- sess.flush()
5439
5422
  g_era = GEra(
5440
5423
  sess,
5441
5424
  self,
@@ -5449,14 +5432,11 @@ class GSupply(Base, PersistentClass):
5449
5432
  g_reading_frequency,
5450
5433
  )
5451
5434
  sess.add(g_era)
5452
- sess.flush()
5453
5435
 
5454
- sess.flush()
5455
5436
  g_era.attach_site(sess, physical_site, True)
5456
5437
  for site in logical_sites:
5457
5438
  g_era.attach_site(sess, site, False)
5458
5439
 
5459
- sess.flush()
5460
5440
  if covered_g_era is not None:
5461
5441
  covered_g_era.update_dates(sess, covered_g_era.start_date, start_date - HH)
5462
5442
  return g_era
@@ -5746,15 +5726,18 @@ class GBatch(Base, PersistentClass):
5746
5726
 
5747
5727
  def __init__(self, sess, g_contract, reference, description):
5748
5728
  self.g_contract = g_contract
5749
- self.update(sess, reference, description)
5729
+ self._update(sess, reference, description)
5750
5730
 
5751
- def update(self, sess, reference, description):
5731
+ def _update(self, sess, reference, description):
5752
5732
  reference = reference.strip()
5753
5733
  if len(reference) == 0:
5754
5734
  raise BadRequest("The batch reference can't be blank.")
5755
5735
 
5756
5736
  self.reference = reference
5757
5737
  self.description = description.strip()
5738
+
5739
+ def update(self, sess, reference, description):
5740
+ self._update(sess, reference, description)
5758
5741
  try:
5759
5742
  sess.flush()
5760
5743
  except SQLAlchemyError:
chellow/views.py CHANGED
@@ -621,8 +621,9 @@ def edi_viewer_get():
621
621
  @home.route("/edi_viewer", methods=["POST"])
622
622
  def edi_viewer_post():
623
623
  segments = []
624
+ file_name = None
624
625
  try:
625
- if "edi_file" in request.values:
626
+ if "edi_file" in request.files:
626
627
  file_item = req_file("edi_file")
627
628
  edi_str = str(
628
629
  file_item.stream.read(), encoding="utf-8-sig", errors="ignore"
@@ -630,7 +631,6 @@ def edi_viewer_post():
630
631
  file_name = file_item.filename
631
632
  else:
632
633
  edi_str = req_str("edi_fragment")
633
- file_name = None
634
634
 
635
635
  f = StringIO(edi_str)
636
636
  f.seek(0)
@@ -723,8 +723,9 @@ def edi_viewer_post():
723
723
  )
724
724
  except BadRequest as e:
725
725
  flash(e.description)
726
- return render_template(
727
- "edi_viewer.html", segments=segments, file_name=file_name
726
+ return make_response(
727
+ render_template("edi_viewer.html", segments=segments, file_name=file_name),
728
+ 400,
728
729
  )
729
730
 
730
731
 
@@ -1,27 +1,27 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chellow
3
- Version: 1692616986.0.0
3
+ Version: 1692867503.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.9
10
- Requires-Dist: flask-restx==1.0.3
11
- Requires-Dist: flask==2.3.2
10
+ Requires-Dist: flask-restx==1.1.0
11
+ Requires-Dist: flask==2.3.3
12
12
  Requires-Dist: odio==0.0.22
13
- Requires-Dist: openpyxl==3.0.10
13
+ Requires-Dist: openpyxl==3.1.2
14
14
  Requires-Dist: pep3143daemon==0.0.6
15
- Requires-Dist: pg8000==1.29.8
15
+ Requires-Dist: pg8000==1.30.1
16
16
  Requires-Dist: pip>=9.0.1
17
- Requires-Dist: psutil==5.9.4
17
+ Requires-Dist: psutil==5.9.5
18
18
  Requires-Dist: pympler==1.0.1
19
- Requires-Dist: pypdf==3.12.0
19
+ Requires-Dist: pypdf==3.15.2
20
20
  Requires-Dist: pysftp==0.2.9
21
21
  Requires-Dist: python-dateutil==2.8.2
22
22
  Requires-Dist: pytz==2022.6
23
23
  Requires-Dist: requests==2.31.0
24
- Requires-Dist: sqlalchemy==2.0.19
24
+ Requires-Dist: sqlalchemy==2.0.20
25
25
  Requires-Dist: waitress==2.1.2
26
26
  Requires-Dist: xlrd==2.0.1
27
27
  Requires-Dist: zish==0.1.10
@@ -5,13 +5,13 @@ chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
5
5
  chellow/dloads.py,sha256=ZeHIu75t71FWJBfew_8sqi03KcMZmDlTWVn7QyyADu4,3942
6
6
  chellow/edi_lib.py,sha256=het3R0DBGtXEo-Sy1zvXQuX9EWQ1X6Y33G4l1hYYuds,51859
7
7
  chellow/general_import.py,sha256=BIv7SLjNVQuDSclWG1-ePCUsethlwm7_NVHI4SlyI8g,58612
8
- chellow/models.py,sha256=-80hNamcKEjOsneQfy-Prep0_wDf71r2zytTiC5cR7Q,234913
8
+ chellow/models.py,sha256=as05fRmAonpuve_RCeaQsnA209_nCmfzhFW8y4zgat4,234458
9
9
  chellow/national_grid.py,sha256=Y0ckPONIpMnip2qB9ptXBLxs6jJCk14c98eCkyd2fNM,4427
10
10
  chellow/proxy.py,sha256=Mzssi9nTf6s_G4RSn8k5oAHqzVYIxMsfbudj1amYucI,1387
11
11
  chellow/rate_server.py,sha256=xVk15pdSovcD8K8BWcOmjwo_L3a8LYry7L2Gvw56OEQ,5696
12
12
  chellow/testing.py,sha256=1TvNEPjX_VRPDifJWRFJw_8gg0RCsEpYVHkspQ1diJw,3913
13
13
  chellow/utils.py,sha256=IHC4Pcd_9CRbmJXAOlDvTyAcUoaWeLSH37zgjqVYYl4,18981
14
- chellow/views.py,sha256=UTQfC_dcs-J-uZ7FVszmO7MYLE8NRCisfcfEzEO1iGE,83636
14
+ chellow/views.py,sha256=fNHCxCdws07jxaveclIspJIOb8tiXf4Xqo0PkZDs2Ak,83660
15
15
  chellow/e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  chellow/e/aahedc.py,sha256=DUrYAlrn4jzf6y6C2wivxlFosdVIibG69BWy_KMekGM,706
17
17
  chellow/e/bill_importer.py,sha256=BHrQkcvlOh27k0KexHA8nWJGcHGGpewbkkpncmxbAc4,7183
@@ -352,6 +352,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
352
352
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
353
353
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
354
354
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
355
- chellow-1692616986.0.0.dist-info/METADATA,sha256=k2UORjuSyN2KJgTojw4qGbiEaVVid0XueywbUu4XjGc,12161
356
- chellow-1692616986.0.0.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
357
- chellow-1692616986.0.0.dist-info/RECORD,,
355
+ chellow-1692867503.0.0.dist-info/METADATA,sha256=lIdX4pYwSAUf3e8vpQ85B9jxXn9-Bm_bfb2VO4zSZ9s,12160
356
+ chellow-1692867503.0.0.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
357
+ chellow-1692867503.0.0.dist-info/RECORD,,