phanterpwa 14.0.6__py3-none-any.whl → 14.0.10__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.
phanterpwa/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  # license: MIT
4
4
 
5
5
  __author__ = "PhanterJR<junior.conex@gmail.com>"
6
- __version__ = "14.0.6"
6
+ __version__ = "14.0.10"
7
7
  __install_requeriments__ = [
8
8
  "psutil",
9
9
  "tornado",
@@ -1361,17 +1361,21 @@ class FieldsDALValidateDictArgs(object):
1361
1361
  else:
1362
1362
  return None
1363
1363
 
1364
-
1365
1364
  def validate_and_insert(self, dbtable, commit=True):
1366
1365
  self.validate()
1367
1366
  if not self.errors and isinstance(dbtable, Table):
1368
1367
  rep = dbtable.validate_and_insert(**self.verified)
1369
- dbtable._db._adapter.reconnect()
1370
- if rep.errors:
1371
- dbtable._db.rollback()
1372
- elif rep.id and commit:
1373
- dbtable._db.commit()
1374
- return rep
1368
+ if isinstance(rep, dict):
1369
+ if rep.get("errors"):
1370
+ dbtable._db.rollback()
1371
+ elif rep.get("id") and commit:
1372
+ dbtable._db.commit()
1373
+ else:
1374
+ if rep.errors:
1375
+ dbtable._db.rollback()
1376
+ elif rep.id and commit:
1377
+ dbtable._db.commit()
1378
+ return rep
1375
1379
  else:
1376
1380
  if not self.errors:
1377
1381
  raise "The dbtable must be pydal.DAL.Table instance. given: {0}.".format(type(dbtable))
@@ -1380,12 +1384,17 @@ class FieldsDALValidateDictArgs(object):
1380
1384
  self.validate()
1381
1385
  if not self.errors and isinstance(dbset, Set):
1382
1386
  rep = dbset.validate_and_update(**self.verified)
1383
- dbset._db._adapter.reconnect()
1384
- if rep.errors:
1385
- dbset._db.rollback
1386
- elif rep.id and commit:
1387
- dbset._db.commit()
1388
- return rep
1387
+ if isinstance(rep, dict):
1388
+ if rep.get("errors"):
1389
+ dbset._db.rollback()
1390
+ elif rep.get("id") and commit:
1391
+ dbset._db.commit()
1392
+ else:
1393
+ if rep.errors:
1394
+ dbset._db.rollback()
1395
+ elif rep.id and commit:
1396
+ dbset._db.commit()
1397
+ return rep
1389
1398
  else:
1390
1399
  if not self.errors:
1391
1400
  raise "The dbtable must be pydal.Objects.Set instance. given: {0}.".format(type(dbset))
@@ -15,7 +15,7 @@ class CredentialsTables():
15
15
  Field('token', 'text', index=True),
16
16
  Field('auth_user', 'reference auth_user', requires=IS_EMPTY_OR(
17
17
  IS_IN_DB(self.DALDatabase, self.DALDatabase.auth_user))),
18
- Field('date_created', 'datetime', default=datetime.now(), requires=IS_EMPTY_OR(IS_DATETIME())),
18
+ Field('date_created', 'datetime', index=True, default=datetime.now(), requires=IS_EMPTY_OR(IS_DATETIME())),
19
19
  Field('last_resign', 'datetime', default=datetime.now()),
20
20
  Field('remember_me', 'boolean', default=False),
21
21
  Field('locked', 'boolean', default=False),
@@ -26,7 +26,7 @@ class CredentialsTables():
26
26
  Field('form_identify', 'string'),
27
27
  Field('user_agent', 'string'),
28
28
  Field('ip', 'string'),
29
- Field('date_created', 'datetime', default=datetime.now(), requires=IS_DATETIME()),
29
+ Field('date_created', 'datetime', index=True, default=datetime.now(), requires=IS_DATETIME()),
30
30
  Field('client', 'reference client', requires=IS_EMPTY_OR(
31
31
  IS_IN_DB(self.DALDatabase, self.DALDatabase.client)))
32
32
  )
@@ -36,7 +36,7 @@ class CredentialsTables():
36
36
  Field('form_identify', 'string'),
37
37
  Field('user_agent', 'string'),
38
38
  Field('ip', 'string'),
39
- Field('date_created', 'datetime', default=datetime.now(), requires=IS_DATETIME()),
39
+ Field('date_created', 'datetime', index=True, default=datetime.now(), requires=IS_DATETIME()),
40
40
  Field('client', 'reference client', requires=IS_EMPTY_OR(
41
41
  IS_IN_DB(self.DALDatabase, self.DALDatabase.client)))
42
42
  )
@@ -46,7 +46,7 @@ class CredentialsTables():
46
46
  Field('form_identify', 'string'),
47
47
  Field('user_agent', 'string'),
48
48
  Field('ip', 'string'),
49
- Field('date_created', 'datetime', default=datetime.now(), requires=IS_DATETIME()),
49
+ Field('date_created', 'datetime', index=True, default=datetime.now(), requires=IS_DATETIME()),
50
50
  Field('client', 'reference client', requires=IS_EMPTY_OR(
51
51
  IS_IN_DB(self.DALDatabase, self.DALDatabase.client)))
52
52
  )
@@ -98,17 +98,20 @@ class SignClient(web.RequestHandler):
98
98
  deactived_user_expire_date = datetime.now() - timedelta(seconds=self.projectConfig['BACKEND'][self.app_name]['default_time_user_token_expire_remember_me'])
99
99
  str_expire_date = expire_date.strftime('%Y-%m-%d %H:%M:%S')
100
100
  str_anonymous_expire_date = anonymous_expire_date.strftime('%Y-%m-%d %H:%M:%S')
101
- self.DALDatabase(
102
- (self.DALDatabase.client.date_created < str_expire_date)
103
- ).delete()
104
- self.DALDatabase(
105
- (self.DALDatabase.client.auth_user == None)
106
- & (self.DALDatabase.client.date_created < str_anonymous_expire_date)
107
- ).delete()
108
- self.DALDatabase(
109
- (self.DALDatabase.auth_user.activated == False)
110
- & ((self.DALDatabase.auth_user.date_created < deactived_user_expire_date) | (self.DALDatabase.auth_user.date_created == None))
111
- ).delete()
101
+ global CLEANUP_TIME
102
+ if CLEANUP_TIME < datetime.now() - timedelta(seconds=600):
103
+ CLEANUP_TIME = datetime.now()
104
+ self.DALDatabase(
105
+ (self.DALDatabase.client.date_created < str_expire_date)
106
+ ).delete()
107
+ self.DALDatabase(
108
+ (self.DALDatabase.client.auth_user == None)
109
+ & (self.DALDatabase.client.date_created < str_anonymous_expire_date)
110
+ ).delete()
111
+ self.DALDatabase(
112
+ (self.DALDatabase.auth_user.activated == False)
113
+ & ((self.DALDatabase.auth_user.date_created < deactived_user_expire_date) | (self.DALDatabase.auth_user.date_created == None))
114
+ ).delete()
112
115
 
113
116
  self.phanterpwa_client_token = self.request.headers.get('phanterpwa-client-token')
114
117
  self.phanterpwa_authorization = self.request.headers.get('phanterpwa-authorization')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phanterpwa
3
- Version: 14.0.6
3
+ Version: 14.0.10
4
4
  Summary: Tools for the phanterpwadeveloper framework
5
5
  Home-page: https://github.com/PhanterJR/phanterpwa
6
6
  Author: PhanterJR
@@ -1,4 +1,4 @@
1
- phanterpwa/__init__.py,sha256=3NdBZqYm1m0raDqDmK9tLFd72JJ1GgE_3-iBdaa3B1Y,396
1
+ phanterpwa/__init__.py,sha256=uUDACNGUFDbFmyLH1iAvaKXCgsi_tLpCzhYwmmwwEKU,397
2
2
  phanterpwa/__main__.py,sha256=1vSHtv6-sgAgpZiklf9bwarXX1b-fmKx1rjwJw4h78o,4017
3
3
  phanterpwa/compiler.py,sha256=Je3qtVO_cZ69_PPWcXKyBgnRfQ-Ev-zkZ3UTN-ddOTQ,47478
4
4
  phanterpwa/configer.py,sha256=PFO_nVy9r6yt5iDso1amDIR0Ge2UYYK3h-ae9M0Ezyk,26359
@@ -10,13 +10,13 @@ phanterpwa/sms.py,sha256=XUULyDSk5gPjBqupchIcaGv-C6kX66XxrXpmzfnSp_A,1313
10
10
  phanterpwa/tools.py,sha256=X_R_pWIegts8rNmDwVI_MmJ9PyXr5H64IrB2jXX9twc,46596
11
11
  phanterpwa/xmlconstructor.py,sha256=DMtc9BXI2NMGGmLszZXh2A63Iv0D1qgoWtn0aKyrmoo,162695
12
12
  phanterpwa/backend/__init__.py,sha256=zB8rm2I9O3f448YsuaupgBlAoqZAiVM5vEoWnOOGvdw,68
13
- phanterpwa/backend/dataforms.py,sha256=HwR8D-4vBNXdN5MSpZmjelo-Az92lVvOTIzpbHnPpsg,64543
13
+ phanterpwa/backend/dataforms.py,sha256=Silp0p-QaZkSz69oq2NZdlM7beH4v-JIsOW5RKEn1xg,64951
14
14
  phanterpwa/backend/decorators.py,sha256=gPqFjUe8BCci59hBv72j2wvKZB3L5HLZIE-3ESA2wLU,56094
15
15
  phanterpwa/backend/security.py,sha256=USPky7nqTKASAN60yYs7-NnoR82LMZlf9aGlfz1QbXM,1300
16
16
  phanterpwa/backend/pydal/__init__.py,sha256=lpPDHcS9anJ5ceRSW9fBVuAgKK5qtjSoMsVjp3_nCdw,55
17
17
  phanterpwa/backend/pydal/auth.py,sha256=fvRI4vyjjl0ZBuCGjcinp4mVd8sU4Wd1skLoHX_ter8,8606
18
18
  phanterpwa/backend/pydal/cas.py,sha256=PJvHZdXu4JQM0BAEkYSMTw-_Zc8zrlXR200GTA869kg,1581
19
- phanterpwa/backend/pydal/credentials.py,sha256=CInkGkZtJ1c_3qiASDaMXSgwQSlb14CrYOg2WG8RjiA,2283
19
+ phanterpwa/backend/pydal/credentials.py,sha256=b3qeobNmm7pGB7hmbAYpxq2BT222UZ2wpcuDOJ3VXpE,2331
20
20
  phanterpwa/backend/pydal/extra_validations.py,sha256=1FlOZhUuYg4aybL4EwSzH3zWUXbGtOwxxfVxK-qjHkM,1919
21
21
  phanterpwa/backend/pydal/gallery.py,sha256=nETfQ2Dv-0N94Ypq14uGiDKeGlWgxDHLjY4s1zFrnWs,870
22
22
  phanterpwa/backend/pydal/internal_messages.py,sha256=DYDNWpjrvAM0Nn4m5fGkJXJsMVQjwuJgcMaRzOEzmE4,1379
@@ -24,7 +24,7 @@ phanterpwa/backend/request_handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQ
24
24
  phanterpwa/backend/request_handlers/admin.py,sha256=QnpoCTMRBuviSCdB84G0pUb13kIg6ky8Wv4DEVB7tRQ,63978
25
25
  phanterpwa/backend/request_handlers/auth.py,sha256=epJ2ura3u6YDKNRmvyYGR7FzF1nrgwTpneibP0z9zzw,177284
26
26
  phanterpwa/backend/request_handlers/cas.py,sha256=TeeQaodcHVkhu-cUqesh9NeAuo0oXylzcPXpQ9wG6H4,24996
27
- phanterpwa/backend/request_handlers/credentials.py,sha256=OvLnVHixJSwBYUj-GRLEmeO21Z-sG1T4htRzlsQmk3s,51366
27
+ phanterpwa/backend/request_handlers/credentials.py,sha256=Gs6Rje80A8PaPqYpB39dMlikcXewp9pOLFR9JROH-mU,51550
28
28
  phanterpwa/backend/request_handlers/errors.py,sha256=x3SMdpkO4mxaSRZZQQxtH1zUFh47C06kssfI4CoPokc,4472
29
29
  phanterpwa/backend/request_handlers/i18n_server.py,sha256=p3LQxOdcLHIjgaFs4wO1V2_7gKpfcDT7pDPa7m0-UbQ,3205
30
30
  phanterpwa/backend/request_handlers/internal_messages.py,sha256=w_u3NYw0KZfuCIS8tHJhV12tj_UA0_aBekk22nR3oCc,17382
@@ -435,10 +435,10 @@ phanterpwa/usual_sass/preloaders/indefined_text.sass,sha256=z4JuUtBrzoqH3HuNFXvN
435
435
  phanterpwa/usual_sass/preloaders/run_points.sass,sha256=EYl93ljfgAc-ZLJ0VScrCoIlHP7Nr6NLdxj1zk2wm_E,3367
436
436
  phanterpwa/usual_sass/preloaders/square.sass,sha256=TOsh9muP4zkYLUJcw4i1LeRs60NrtgRWBk_1oMt2_58,1348
437
437
  phanterpwa/usual_sass/preloaders/squares.sass,sha256=kH1I89qEfmbvYxCtKFVNcxP5bWIjnqbheXVnyGF0VNo,3862
438
- phanterpwa-14.0.6.dist-info/LICENSE,sha256=lGEW1PRSZOkug2-d0IJgryCjqt6zhxN5x9pFgy3lx2E,1087
439
- phanterpwa-14.0.6.dist-info/METADATA,sha256=ya2fnu4206aMHEsZCS0HAJc8YcPda-N7XVq2oxiERSo,1938
440
- phanterpwa-14.0.6.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
441
- phanterpwa-14.0.6.dist-info/dependency_links.txt,sha256=Pslekmz-4l1SpBO0x2aYkYZPCScmbrB9HUq1YvXYUzM,40
442
- phanterpwa-14.0.6.dist-info/entry_points.txt,sha256=siJH2lFXIdsUBDRgcXV4blOb2_iku1vcbqxJ-trIQrw,56
443
- phanterpwa-14.0.6.dist-info/top_level.txt,sha256=nF1WJ8AByxBv3bLKp3xySR2l2Twrj5n5n7C404lULSk,5319
444
- phanterpwa-14.0.6.dist-info/RECORD,,
438
+ phanterpwa-14.0.10.dist-info/LICENSE,sha256=lGEW1PRSZOkug2-d0IJgryCjqt6zhxN5x9pFgy3lx2E,1087
439
+ phanterpwa-14.0.10.dist-info/METADATA,sha256=I1YnPPU8fWCKwFA16-MWGt0VdxrLdc19uKqKI7dXa4o,1939
440
+ phanterpwa-14.0.10.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
441
+ phanterpwa-14.0.10.dist-info/dependency_links.txt,sha256=Pslekmz-4l1SpBO0x2aYkYZPCScmbrB9HUq1YvXYUzM,40
442
+ phanterpwa-14.0.10.dist-info/entry_points.txt,sha256=siJH2lFXIdsUBDRgcXV4blOb2_iku1vcbqxJ-trIQrw,56
443
+ phanterpwa-14.0.10.dist-info/top_level.txt,sha256=nF1WJ8AByxBv3bLKp3xySR2l2Twrj5n5n7C404lULSk,5319
444
+ phanterpwa-14.0.10.dist-info/RECORD,,