appier 1.34.4__py2.py3-none-any.whl → 1.34.6__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/base.py CHANGED
@@ -94,7 +94,7 @@ NAME = "appier"
94
94
  """ The name to be used to describe the framework while working
95
95
  on its own environment, this is just a descriptive value """
96
96
 
97
- VERSION = "1.34.4"
97
+ VERSION = "1.34.6"
98
98
  """ The version of the framework that is currently installed
99
99
  this value may be used for debugging/diagnostic purposes """
100
100
 
@@ -1781,7 +1781,7 @@ class App(
1781
1781
  # so that class level operations may be performed
1782
1782
  cls = self.__class__
1783
1783
 
1784
- # tries to ensure that the UID value of the exception is set,
1784
+ # tries to ensure that the UUID value of the exception is set,
1785
1785
  # notice that under some extreme occasions it may not be possible
1786
1786
  # to ensure such behavior (eg: native code based exception)
1787
1787
  if not hasattr(exception, "uid"):
@@ -1821,6 +1821,10 @@ class App(
1821
1821
  # "raised" by the current exception object in handling
1822
1822
  self.request.set_headers(headers)
1823
1823
 
1824
+ # sets the additional error trace identifier header in the request, to allow
1825
+ # extra debug support for the error
1826
+ self.request.set_header("X-Error-Id", exception.uid)
1827
+
1824
1828
  # runs the on error processor in the base application object and in case
1825
1829
  # a value is returned by a possible handler it is used as the response
1826
1830
  # for the current request (instead of the normal handler)
@@ -2232,7 +2236,7 @@ class App(
2232
2236
  def warning(self, message):
2233
2237
  self.request.warning(message)
2234
2238
 
2235
- def redirect(self, url, code=303, params=None, **kwargs):
2239
+ def redirect(self, url, code=303, relative=False, params=None, **kwargs):
2236
2240
  # in case there are no explicit parameters provided then the
2237
2241
  # named arguments should be used instead
2238
2242
  if params == None:
@@ -2244,6 +2248,15 @@ class App(
2244
2248
  if query:
2245
2249
  url += ("&" if "?" in url else "?") + query
2246
2250
 
2251
+ # in case a relative URL is expected, makes sure we enforce one
2252
+ # preventing possible absolute URL redirections
2253
+ if relative:
2254
+ is_absolute = url.startswith(("http://", "https://", "//"))
2255
+ if is_absolute:
2256
+ raise exceptions.SecurityError(
2257
+ message="Attempt to redirect to absolute URL", code=401
2258
+ )
2259
+
2247
2260
  # sets both the (redirection) code and the new location URL
2248
2261
  # values in the current request (response) object
2249
2262
  self.request.code = code
@@ -2454,11 +2467,7 @@ class App(
2454
2467
 
2455
2468
  parameters = dict(kwargs)
2456
2469
  parameters.update(
2457
- sender=sender,
2458
- receivers=receivers,
2459
- cc=cc,
2460
- bcc=bcc,
2461
- subject=subject,
2470
+ sender=sender, receivers=receivers, cc=cc, bcc=bcc, subject=subject
2462
2471
  )
2463
2472
 
2464
2473
  if html == None:
@@ -4065,9 +4074,7 @@ class App(
4065
4074
  # is possible raises a not found error
4066
4075
  part_s = self.get_part(part)
4067
4076
  if not part_s:
4068
- raise exceptions.NotFoundError(
4069
- message="Part not found '%s'" % part,
4070
- )
4077
+ raise exceptions.NotFoundError(message="Part not found '%s'" % part)
4071
4078
 
4072
4079
  # sends the static information taking into account the
4073
4080
  # provided data and the base static path of the part
@@ -6576,6 +6583,10 @@ class WebApp(App):
6576
6583
  # "raised" by the current exception object in handling
6577
6584
  self.request.set_headers(headers)
6578
6585
 
6586
+ # sets the additional error trace identifier header in the request, to allow
6587
+ # extra debug support for the error
6588
+ self.request.set_header("X-Error-Id", exception.uid)
6589
+
6579
6590
  # run the on error processor in the base application object and in case
6580
6591
  # a value is returned by a possible handler it is used as the response
6581
6592
  # for the current request (instead of the normal handler)
appier/config.py CHANGED
@@ -163,10 +163,7 @@ def load(names=(FILE_NAME,), path=None, encoding="utf-8", ctx=None):
163
163
  paths = []
164
164
  homes = get_homes()
165
165
  for home in homes:
166
- paths += [
167
- os.path.join(home),
168
- os.path.join(home, ".config"),
169
- ]
166
+ paths += [os.path.join(home), os.path.join(home, ".config")]
170
167
  paths += [sys.prefix]
171
168
  paths.append(path)
172
169
  for path in paths:
appier/model.py CHANGED
@@ -148,10 +148,7 @@ so that they are lazy loaded from the data source, these kind
148
148
  of types should be compliant to a common interface so that they
149
149
  may be used "blindly" from an external entity """
150
150
 
151
- REVERSE = dict(
152
- descending="ascending",
153
- ascending="descending",
154
- )
151
+ REVERSE = dict(descending="ascending", ascending="descending")
155
152
  """ The reverse order dictionary that maps a certain
156
153
  order direction (as a string) with the opposite one
157
154
  this may be used to "calculate" the reverse value """
@@ -2260,6 +2257,10 @@ class Model(legacy.with_meta(meta.Ordered, observer.Observable, *EXTRA_CLS)):
2260
2257
  return result
2261
2258
  return base
2262
2259
 
2260
+ @property
2261
+ def identity(self):
2262
+ return self._id
2263
+
2263
2264
  @property
2264
2265
  def request(self):
2265
2266
  return common.base().get_request()
appier/model.pyi CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Callable, Self, Sequence
1
+ from typing import Any, Callable, Self, Sequence
2
2
  from .base import App
3
3
 
4
4
  class Model:
@@ -40,9 +40,28 @@ class Model:
40
40
  before_callbacks: Sequence[Callable[[Self], None]] = ...,
41
41
  after_callbacks: Sequence[Callable[[Self], None]] = ...,
42
42
  ) -> Self: ...
43
+ @property
44
+ def identity(self) -> Any: ...
43
45
  ...
44
46
 
45
47
  class Field:
46
48
  def __init__(self, *args, **kwargs): ...
47
49
 
50
+ def link(
51
+ name: str | None = ...,
52
+ description: str | None = ...,
53
+ parameters: tuple = ...,
54
+ context: bool = ...,
55
+ devel: bool = ...,
56
+ ) -> Callable[[Callable], Callable]: ...
57
+ def operation(
58
+ name: str | None = ...,
59
+ description: str | None = ...,
60
+ parameters: tuple = ...,
61
+ kwargs: dict[str, Any] | None = ...,
62
+ factory: bool = ...,
63
+ level: int = ...,
64
+ devel: bool = ...,
65
+ ) -> Callable[[Callable], Callable]: ...
66
+
48
67
  field = Field
appier/test/base.py CHANGED
@@ -173,7 +173,7 @@ class BaseTest(unittest.TestCase):
173
173
  invalid_email=["john"],
174
174
  valid_length=["1234"],
175
175
  invalid_length=["12345"],
176
- ),
176
+ )
177
177
  )
178
178
  self.app._request = request
179
179
 
@@ -369,10 +369,7 @@ class BaseTest(unittest.TestCase):
369
369
  self.skipTest("No Jinja2 template engine present")
370
370
 
371
371
  self.app._register_bundle(
372
- {
373
- "hello": appier.legacy.u("olá"),
374
- "world": appier.legacy.u("mundo"),
375
- },
372
+ {"hello": appier.legacy.u("olá"), "world": appier.legacy.u("mundo")},
376
373
  "pt_pt",
377
374
  )
378
375
 
appier/test/util.py CHANGED
@@ -555,11 +555,7 @@ class UtilTest(unittest.TestCase):
555
555
  self.assertEqual(type(result), list)
556
556
  self.assertEqual(result, [])
557
557
 
558
- result = appier.email_base(
559
- [
560
- appier.legacy.u(""),
561
- ]
562
- )
558
+ result = appier.email_base([appier.legacy.u("")])
563
559
  self.assertEqual(type(result), list)
564
560
  self.assertEqual(result, [])
565
561
 
@@ -582,8 +578,7 @@ class UtilTest(unittest.TestCase):
582
578
  raise appier.OperationalError(message="hello")
583
579
 
584
580
  struct = appier.lazy_dict(
585
- first=appier.lazy(lambda: raiser()),
586
- second=appier.lazy(lambda: 2),
581
+ first=appier.lazy(lambda: raiser()), second=appier.lazy(lambda: 2)
587
582
  )
588
583
 
589
584
  errors = appier.gather_errors(struct)
@@ -1077,15 +1072,7 @@ class UtilTest(unittest.TestCase):
1077
1072
  ),
1078
1073
  )
1079
1074
 
1080
- first = {
1081
- "info": {
1082
- "personal": {
1083
- "general": {
1084
- "kind": "human",
1085
- }
1086
- }
1087
- }
1088
- }
1075
+ first = {"info": {"personal": {"general": {"kind": "human"}}}}
1089
1076
  second = {
1090
1077
  "info": {
1091
1078
  "personal": {"general": {"kind": "cat", "tail": "long", "meaw": 12}},
appier/util.py CHANGED
@@ -68,12 +68,7 @@ ALL_CAP_REGEX = re.compile(r"([a-z0-9])([A-Z])")
68
68
  upper case letter regex that will provide a way of
69
69
  putting the underscore in the middle of the transition """
70
70
 
71
- SORT_MAP = {
72
- "1": 1,
73
- "-1": -1,
74
- "ascending": 1,
75
- "descending": -1,
76
- }
71
+ SORT_MAP = {"1": 1, "-1": -1, "ascending": 1, "descending": -1}
77
72
  """ The map associating the normalized (text) way of
78
73
  representing sorting with the current infra-structure
79
74
  number way of representing the same information """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: appier
3
- Version: 1.34.4
3
+ Version: 1.34.6
4
4
  Summary: Appier Framework
5
5
  Home-page: http://appier.hive.pt
6
6
  Author: Hive Solutions Lda.
@@ -6,7 +6,7 @@ appier/async_neo.py,sha256=gQpyT1-nZE6Uynh5FEmFl5kfXkxChdUsgiKgwlaNw5E,5446
6
6
  appier/async_old.py,sha256=m3BFqHVPCRuIZ9L2sGYhCQPEwuCNKBO2y7SKM0dbtj8,9194
7
7
  appier/asynchronous.py,sha256=a1LQa3wbGMaXELhF7W71dRr1klPOj6x-ST9EInvPhtU,1757
8
8
  appier/asynchronous.pyi,sha256=5CpLkpKcUq09woMOVYwpl24Pli0A8Xu6nXoT20xDQ-o,104
9
- appier/base.py,sha256=LrpESbkdkwV3QD2EBYbMt32y0Z2JW902gNmJL4nvne0,270665
9
+ appier/base.py,sha256=DBXanIgava2RDTW2NbgU8NDTk-6CnoRtEgRAmxaMRHc,271387
10
10
  appier/base.pyi,sha256=CwhdTt6lVGiXsXQewN1kkISD1YRNPCUf9U8fxYUVI3E,2924
11
11
  appier/bus.py,sha256=AMC2UXlaf6rzhzlIyTHkzbfb6tdfPBiOii4lpl9AAwg,7670
12
12
  appier/bus.pyi,sha256=W6_MIBpvDq468wfT5XM2WpPuR3O49QiZMOSCdMsJWos,182
@@ -16,7 +16,7 @@ appier/common.py,sha256=fcECBvu-KcB9DImZzkpM_FA_PUqgCx0FKP4KHuOikYc,1313
16
16
  appier/component.py,sha256=I6xDQp0dmYOarOgbyrXIfXa1RAsVHttd8JjUub15U2M,2988
17
17
  appier/component.pyi,sha256=zKO71mWgi7I8QapKajZHoWznrLyofHigCT4gJvDY3G8,22
18
18
  appier/compress.py,sha256=o3E-at5DjpW2s3uOljEqqfLLyPzEU9cSXHFISk0sPvA,4699
19
- appier/config.py,sha256=C9cgAViSm9QIMVoB-0cv-u12y8rKHpVC3D7WZMRJsxM,11568
19
+ appier/config.py,sha256=4DPhDJlb8frV2gZwLFD05mbUol7Z2-_oaeMV5oZWayw,11530
20
20
  appier/controller.py,sha256=uKzPJnz6aqibspPKf4tfJRvVMtxdDv0RFb0ivcDoepU,2285
21
21
  appier/crypt.py,sha256=Kr7Rbil8_bUp-oE_c_Wu2LRgk8nmVb9ukCHSuXE7RSc,5874
22
22
  appier/data.py,sha256=VIKRNME_SQGm-KzX3-FDwktWTosXAy2i92I1s1GqlGY,14696
@@ -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=6foYOpbDkY1XFaRGQhJY7AdAz0GI3khofaQxQWZZeGM,121826
40
- appier/model.pyi,sha256=IDtn69Y5HuiZYfrpydwiVVN4DOSnzO9pLSMi8Xe7DDU,1314
39
+ appier/model.py,sha256=MPvR6Skn-FuPrKTLBv0l_8qfdVEUkB18bttYJzD_er8,121879
40
+ appier/model.pyi,sha256=Tib26mqYnNAOgsjRaov9T2CmV2pw6IJhdzMYUeN9HM4,1838
41
41
  appier/model_a.py,sha256=c6XpG4oIelXNDK0uicsZ69-f6isUgmh5-29F61PZt9c,16176
42
42
  appier/mongo.py,sha256=t-257ReqFWnEw0bQkDvS4McsPsc6AuKoQXIFHxlrOMw,10891
43
43
  appier/observer.py,sha256=T0QpkxdkcNuEOZJdmJT5nFSJ2e-0VPbGveX5YKtt7mA,4519
@@ -58,7 +58,7 @@ appier/smtp.py,sha256=5tW0dOEm03kejLoQyhRQFjgjYRd-jhb-VlhEKDb4Zn0,3434
58
58
  appier/storage.py,sha256=Qp_CMCDg85q35n9lggNVBZRWwlGrQ-nLYNj0W7Mnbec,7470
59
59
  appier/structures.py,sha256=lwAEiz4k1O4bywGcfHvOvZJusN-lUwcviihR9aZLMtY,8883
60
60
  appier/typesf.py,sha256=XIYRQ2M7ErjvjB0SAu4Rkv3aYUOmWhqfZy3sUYyHtpM,37451
61
- appier/util.py,sha256=e2682yvqkx8ck6p1RsgoBcCwPHw-QgVfzzTZRYXEBU8,86801
61
+ appier/util.py,sha256=3CceJ5SF9M53FOJf_GXyKW2Wqvy5i72kmZDqDoz18RU,86777
62
62
  appier/validation.py,sha256=vxb289skd7RfGEQVmpkQxYb71JdAfLu17QaKOuAAEEQ,22388
63
63
  appier/res/static/css/base.css,sha256=J9zLozd57KoslAsrsj2a42glGTObxbkrrckR-W-_f2A,6127
64
64
  appier/res/static/images/favicon.ico,sha256=fAL8DLx_0Yl6jwpRG_K6S7g3yXxr9Hyjn3JmqyU8t7U,1150
@@ -67,7 +67,7 @@ appier/res/templates/error.html.tpl,sha256=CiKD-gCC1Zed0zfPFEo6a8qqrEz8Ye9LT-L45
67
67
  appier/res/templates/holder.html.tpl,sha256=lV-z0796VhGcowE9rG9MziHbu2S4H1uxfPmqsbx3ddA,1076
68
68
  appier/res/templates/layout.html.tpl,sha256=e6CVkHTtF8zlFClKFBVWJgMZQ1paHi_240pXahH73BY,2183
69
69
  appier/test/__init__.py,sha256=zMHH-X-dnws-iNXL4JudfPNz1h5oeRSXeS5O5TjoyZk,990
70
- appier/test/base.py,sha256=dJyWcr8egJkrjw4_p9LkUTi9GsFpL82i3lu0nJGrzcc,14857
70
+ appier/test/base.py,sha256=wVNgryfbHLu8niligtDlVFgpyG4rzFuvdKDIQqm1tHg,14806
71
71
  appier/test/cache.py,sha256=WpbfgdsXfAN9Zwo0MZvATygdl-03yqsDYAWKfn4gQf0,6922
72
72
  appier/test/config.py,sha256=r34Rtzzp5X4AkB7MuwiuRi6KF0zTUpLWphymCz90FBE,3472
73
73
  appier/test/crypt.py,sha256=wXIHJjKZJe9qhKfIeGMz5PvQWYRIQVnwbKW-dwUukAo,2457
@@ -90,10 +90,10 @@ appier/test/session.py,sha256=KdiYLLB5autIEu1sHwOuYJXVd0y6RMPgg0ITBuRTMfA,4419
90
90
  appier/test/smtp.py,sha256=XJNa0ZTmabdrX8MfVMgcqBxabvBfHgIimvozdziP4_E,1826
91
91
  appier/test/structures.py,sha256=MRjUFRlnJi-i7YGWW5y792JbJwicNvOIzVAS220tgeQ,8367
92
92
  appier/test/typesf.py,sha256=KHumQFzx7wPZSCb8_mpIwobhIy2Fh_0XYviwPjXMbKI,9680
93
- appier/test/util.py,sha256=SSHuBAZQ0TcXLDYI0xUvmwId5nndDZb88s_5Y-Hqibw,46884
93
+ appier/test/util.py,sha256=vfnleU3BUaqMs1mrpXjKom3V_zFOzrsjhmQ8sYp1GaQ,46668
94
94
  appier/test/validation.py,sha256=riOCsGKob1P5jnbcB5qGZ45ApimNAVS0byg9v_uUdrk,4952
95
- appier-1.34.4.dist-info/LICENSE,sha256=Pd-b5cKP4n2tFDpdx27qJSIq0d1ok0oEcGTlbtL6QMU,11560
96
- appier-1.34.4.dist-info/METADATA,sha256=RY0l9rKuJ7OO5lZOM9PM2mAjyo3QiF6B0jRL3OT4v0s,1920
97
- appier-1.34.4.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
98
- appier-1.34.4.dist-info/top_level.txt,sha256=Z2e_Y1ya06a554WwQZkfNRiaaQxqsdaPtBzrck384Lo,7
99
- appier-1.34.4.dist-info/RECORD,,
95
+ appier-1.34.6.dist-info/LICENSE,sha256=Pd-b5cKP4n2tFDpdx27qJSIq0d1ok0oEcGTlbtL6QMU,11560
96
+ appier-1.34.6.dist-info/METADATA,sha256=pLM7760YEqICe8Lc0rPa0YhqvwDDT8I550v60njB4nI,1920
97
+ appier-1.34.6.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
98
+ appier-1.34.6.dist-info/top_level.txt,sha256=Z2e_Y1ya06a554WwQZkfNRiaaQxqsdaPtBzrck384Lo,7
99
+ appier-1.34.6.dist-info/RECORD,,