Skip to content

Commit 9b3b1fc

Browse files
committed
remove undefined symbols in mailer, thanks Hadi
1 parent 3e3554c commit 9b3b1fc

3 files changed

Lines changed: 28 additions & 19 deletions

File tree

pydal/adapters/mssql.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,13 @@ def _initialize_(self):
206206
passwd=self.credential_decoder(password),
207207
)
208208

209-
#Added support for Pymssql
209+
210+
# Added support for Pymssql
210211
@adapters.register_for("pymssql")
211212
class PyMssql(MSSQL):
212213
def _initialize_(self):
213-
import pymssql
214+
import pymssql
215+
214216
self.driver = pymssql
215217
super(MSSQL, self)._initialize_()
216218
ruri = self.uri.split("://", 1)[1]
@@ -240,13 +242,13 @@ def connector(self):
240242
class MSSQLPython(MSSQL4):
241243
"""
242244
MSSQL adapter for Microsoft's official mssql-python driver.
243-
245+
244246
Supports SQL Server 2012+ with modern OFFSET/FETCH pagination.
245247
Features encryption-by-default and Microsoft Entra ID authentication.
246-
248+
247249
URI format:
248250
mssqlpython://user:password@server:port/database?param=value
249-
251+
250252
Supported URI parameters:
251253
- encrypt: Enable encryption (default: yes, values: yes/no/true/false/1/0)
252254
- trust_server_certificate: Trust self-signed certificates (default: no)
@@ -258,22 +260,25 @@ class MSSQLPython(MSSQL4):
258260
* ActiveDirectoryIntegrated: Integrated Windows Auth/Kerberos
259261
* ActiveDirectoryDefault: Default authentication based on environment
260262
* ActiveDirectoryDeviceCode: Device code flow authentication
261-
263+
262264
Example URIs:
263265
# Standard SQL authentication with encryption
264266
mssqlpython://user:pass@server.database.windows.net:1433/mydb
265-
267+
266268
# Entra ID Interactive authentication
267269
mssqlpython://user@server.database.windows.net/mydb?authentication=ActiveDirectoryInteractive
268-
270+
269271
# Managed Identity (no user/password needed)
270272
mssqlpython://@server.database.windows.net/mydb?authentication=ActiveDirectoryMSI
271-
273+
272274
# Disable encryption (for testing/legacy)
273275
mssqlpython://user:pass@localhost:1433/mydb?encrypt=no&trust_server_certificate=yes
274276
"""
275-
drivers = ("mssql-python",) # Note: URI scheme is mssqlpython://, driver name is mssql-python
276-
277+
278+
drivers = (
279+
"mssql-python",
280+
) # Note: URI scheme is mssqlpython://, driver name is mssql-python
281+
277282
# Override REGEX_URI to make user optional for Managed Identity scenarios
278283
REGEX_URI = (
279284
r"^(?P<user>[^:@]*)(:(?P<password>[^@]*))?"
@@ -284,6 +289,7 @@ class MSSQLPython(MSSQL4):
284289

285290
def _initialize_(self):
286291
import mssql_python
292+
287293
self.driver = mssql_python
288294
# Skip MSSQL._initialize_() and call grandparent to avoid base MSSQL's REGEX
289295
super(MSSQL, self)._initialize_()
@@ -298,15 +304,17 @@ def _initialize_(self):
298304

299305
# Extract basic connection parameters
300306
user = self.credential_decoder(m.group("user")) if m.group("user") else ""
301-
password = self.credential_decoder(m.group("password")) if m.group("password") else ""
302-
307+
password = (
308+
self.credential_decoder(m.group("password")) if m.group("password") else ""
309+
)
310+
303311
# Build driver connection arguments
304312
self.driver_args.update(
305313
server=m.group("host"),
306314
database=m.group("db"),
307315
port=int(m.group("port") or "1433"),
308316
)
309-
317+
310318
# Add credentials if provided (not required for some Entra ID auth modes)
311319
if user:
312320
self.driver_args["user"] = user
@@ -315,7 +323,7 @@ def _initialize_(self):
315323

316324
# Handle authentication parameter
317325
# Supported modes: ActiveDirectoryPassword, ActiveDirectoryInteractive,
318-
# ActiveDirectoryMSI, ActiveDirectoryServicePrincipal,
326+
# ActiveDirectoryMSI, ActiveDirectoryServicePrincipal,
319327
# ActiveDirectoryIntegrated, ActiveDirectoryDefault, ActiveDirectoryDeviceCode
320328
if "authentication" in uri_args:
321329
self.driver_args["authentication"] = uri_args["authentication"]
@@ -345,4 +353,4 @@ def _initialize_(self):
345353
self.driver_args[key] = value
346354

347355
def connector(self):
348-
return self.driver.connect(**self.driver_args)
356+
return self.driver.connect(**self.driver_args)

pydal/objects.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ def get_default_validator(field, _cached_defaults={}):
143143
else:
144144
validator = validators.Validator()
145145

146-
147146
if validator is not None and not field.notnull:
148147
validator = validators.IS_NULL_OR(validator)
149148
return validators.DefaultValidatorProxy(validator)
@@ -192,7 +191,9 @@ def __contains__(self, k):
192191
key = str(k)
193192

194193
_extra = BasicStorage.get(self, "_extra", None)
195-
return (_extra is not None and k in _extra) or BasicStorage.__contains__(self, key)
194+
return (_extra is not None and k in _extra) or BasicStorage.__contains__(
195+
self, key
196+
)
196197

197198
def __repr__(self):
198199
return "<Row %s>" % self.as_dict(custom_types=[LazySet])

tests/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,7 @@ def testRun(self):
21722172
db.meeting.insert(
21732173
start_date=datetime.date(2025, 11, 26),
21742174
start_time=datetime.time(12, 30),
2175-
bookedon=datetime.datetime(2025, 10, 20, 11, 30, 0)
2175+
bookedon=datetime.datetime(2025, 10, 20, 11, 30, 0),
21762176
)
21772177
db(db.meeting.id == 1).update(
21782178
bookedon=datetime.datetime(2025, 10, 20, 11, 30, 0)

0 commit comments

Comments
 (0)