appier 1.34.8__py2.py3-none-any.whl → 1.34.10__py2.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.
appier/__init__.py CHANGED
@@ -235,6 +235,7 @@ from .model import (
235
235
  Model,
236
236
  LocalModel,
237
237
  Field,
238
+ ValidationRules,
238
239
  link,
239
240
  operation,
240
241
  view,
appier/model.py CHANGED
@@ -661,26 +661,38 @@ class Model(legacy.with_meta(meta.Ordered, observer.Observable, *EXTRA_CLS)):
661
661
  # this is going to be used for operations on the parameters
662
662
  request = common.base().get_request()
663
663
 
664
- # counts the total number of references according to the
664
+ # counts the total number of entities according to the
665
665
  # current filter value and then uses this value together
666
- # with the skip value to calculate both the number of pages
666
+ # with the limit value to calculate both the number of pages
667
667
  # available for the current filter and the current page index
668
668
  # (note that the index is one index based)
669
669
  total = cls.count(*args, **kwargs)
670
- count = total / float(limit)
671
- count = math.ceil(count)
672
- count = int(count)
673
670
  index = skip / float(limit)
674
671
  index = math.floor(index)
675
672
  index = int(index) + 1
676
673
 
677
- # calculates the proper size of the current page being requested
678
- # taking into account the total number of values and the limit
679
- size = total % limit if index == count else limit
680
- if size == 0 and total > 0:
681
- size = limit
682
- if total == 0:
683
- size = 0
674
+ # forks logic for continuous and discrete paging, they
675
+ # require different calculations for the number of pages and
676
+ # the size of the current page
677
+ if total == None:
678
+ # sets the values to None in case the count is None
679
+ # because there's no way to calculate the number of pages
680
+ # for the model provider
681
+ count, size = None, None
682
+ else:
683
+ # calculates both the number of pages that are available
684
+ # for the current entity
685
+ count = total / float(limit)
686
+ count = math.ceil(count)
687
+ count = int(count)
688
+
689
+ # calculates the proper size of the current page being requested
690
+ # taking into account the total number of values and the limit
691
+ size = total % limit if index == count else limit
692
+ if size == 0 and total > 0:
693
+ size = limit
694
+ if total == 0:
695
+ size = 0
684
696
 
685
697
  # creates the base structure for the page populating with the
686
698
  # base values that may be used for display of the page
@@ -695,6 +707,8 @@ class Model(legacy.with_meta(meta.Ordered, observer.Observable, *EXTRA_CLS)):
695
707
  direction=request.params_f.get("direction", "descending"),
696
708
  )
697
709
 
710
+ # generates the query string for the context provided as keyword
711
+ # arguments, this can be used to generating sorting links for instance
698
712
  def generate(**kwargs):
699
713
  # creates the linear parameters list that is going to hold multiple
700
714
  # key and value tuple representing the multiple parameters
@@ -1760,6 +1774,11 @@ class Model(legacy.with_meta(meta.Ordered, observer.Observable, *EXTRA_CLS)):
1760
1774
  collection = adapter.collection_a(name)
1761
1775
  return collection
1762
1776
 
1777
+ @classmethod
1778
+ def _object_id(cls, value=None):
1779
+ adapter = cls._adapter()
1780
+ return adapter.object_id(value=value)
1781
+
1763
1782
  @classmethod
1764
1783
  def _name(cls):
1765
1784
  # retrieves the class object for the current instance and then
@@ -3246,3 +3265,5 @@ def is_unset(value):
3246
3265
 
3247
3266
 
3248
3267
  field = Field
3268
+
3269
+ ValidationRules = None
appier/model.pyi CHANGED
@@ -1,6 +1,8 @@
1
1
  from typing import Any, Callable, Self, Sequence
2
2
  from .base import App
3
3
 
4
+ ValidationRules = Sequence[Callable[[dict, Any], bool]]
5
+
4
6
  class Model:
5
7
  owner: App
6
8
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: appier
3
- Version: 1.34.8
3
+ Version: 1.34.10
4
4
  Summary: Appier Framework
5
5
  Home-page: http://appier.hive.pt
6
6
  Author: Hive Solutions Lda.
@@ -1,4 +1,4 @@
1
- appier/__init__.py,sha256=08H8QW5pI-hvrdOAjeNem3Z2MgVxMbsTr0lbi7UCSt0,9414
1
+ appier/__init__.py,sha256=AjX-Sh9-Xh9ojQoEH3Tuabt4I0V9tAhKoHiC9i3x9bQ,9436
2
2
  appier/amqp.py,sha256=etYxUlfaK27Og_9FJ6qCgNLSYhnz9XgVhIhSmD2ITW4,3852
3
3
  appier/api.py,sha256=ZWRdjrEEUvCDcW_pp2BDgGCdNnS7tjdaZSzUfzSRzmQ,14778
4
4
  appier/asgi.py,sha256=Gubv7W8aLeLhaBxInE2Gc7Y2rxacbSlglAaKj25T6NY,12622
@@ -36,8 +36,8 @@ appier/legacy.py,sha256=o_oJ_2lqZELZKwkvfGt0aDam6ZSZiZiL7FYygNjrDbY,15881
36
36
  appier/log.py,sha256=jhV7ub5nZwrLzY7x-tZDJfb8tcsXu-ndWxxrCspBUdU,12825
37
37
  appier/meta.py,sha256=rgBLOjD6QU9CGYsbCQS3Fy4iY14uk1-Kd8ljkfmxxzc,7168
38
38
  appier/mock.py,sha256=WoWa67rb8qV_ogToQJCdT0R-rCw9RUY24EkA4bYR1G4,5800
39
- appier/model.py,sha256=KTyAdLgxhbRlIUhuFtKysblw4JRZNnAm0Pl3G1YbpSw,122125
40
- appier/model.pyi,sha256=Tib26mqYnNAOgsjRaov9T2CmV2pw6IJhdzMYUeN9HM4,1838
39
+ appier/model.py,sha256=0V_91vft3fMAFm5KzFILb-gdpoDqX6g66UGXxMYf_Jo,123021
40
+ appier/model.pyi,sha256=prhI4tdSILryvLbDC65s4LwAt-LbkBtaTN5ltsotlOw,1897
41
41
  appier/model_a.py,sha256=c6XpG4oIelXNDK0uicsZ69-f6isUgmh5-29F61PZt9c,16176
42
42
  appier/mongo.py,sha256=rU3lRroXij6x17aKFBAbuiu8Cu2xOIP-DbDtI59Ln44,11535
43
43
  appier/observer.py,sha256=T0QpkxdkcNuEOZJdmJT5nFSJ2e-0VPbGveX5YKtt7mA,4519
@@ -95,8 +95,8 @@ appier/test/tags.py,sha256=uf52pCsZL4-yp7i3Tk7F9T6aN4uYvYxbwcUUo-b7-0E,3861
95
95
  appier/test/typesf.py,sha256=KHumQFzx7wPZSCb8_mpIwobhIy2Fh_0XYviwPjXMbKI,9680
96
96
  appier/test/util.py,sha256=vfnleU3BUaqMs1mrpXjKom3V_zFOzrsjhmQ8sYp1GaQ,46668
97
97
  appier/test/validation.py,sha256=riOCsGKob1P5jnbcB5qGZ45ApimNAVS0byg9v_uUdrk,4952
98
- appier-1.34.8.dist-info/LICENSE,sha256=Pd-b5cKP4n2tFDpdx27qJSIq0d1ok0oEcGTlbtL6QMU,11560
99
- appier-1.34.8.dist-info/METADATA,sha256=C7FHzfPF2mpqNxwDiqcF8ZqACCNi5SIXGXEnVVJsxgA,1920
100
- appier-1.34.8.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
101
- appier-1.34.8.dist-info/top_level.txt,sha256=Z2e_Y1ya06a554WwQZkfNRiaaQxqsdaPtBzrck384Lo,7
102
- appier-1.34.8.dist-info/RECORD,,
98
+ appier-1.34.10.dist-info/LICENSE,sha256=Pd-b5cKP4n2tFDpdx27qJSIq0d1ok0oEcGTlbtL6QMU,11560
99
+ appier-1.34.10.dist-info/METADATA,sha256=VC1UThVDF-lmlG71Rquf_tIQDxtJMCkcxeenfst1WUs,1921
100
+ appier-1.34.10.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
101
+ appier-1.34.10.dist-info/top_level.txt,sha256=Z2e_Y1ya06a554WwQZkfNRiaaQxqsdaPtBzrck384Lo,7
102
+ appier-1.34.10.dist-info/RECORD,,