Skip to content

Commit b265785

Browse files
committed
fix routing bugs, fix tests
1 parent 5e8bc16 commit b265785

File tree

10 files changed

+28
-21
lines changed

10 files changed

+28
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
commit 5e8bc165eba61837996728bc4171fff43fedffdf
2+
Author: Alexeev Bronislav <[email protected]>
3+
Date: Fri Jul 4 05:02:30 2025 +0700
4+
5+
add tests; detect bag with parsing
6+
17
commit f9ecca35b7d71e353189b7dce8f6f5eb02b85ad3
28
Author: Alexeev Bronislav <[email protected]>
39
Date: Wed Jul 2 02:46:35 2025 +0700

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Welcome to **EchoNext**, where innovation meets simplicity! Are you tired of the
5959

6060
**Imagine** a lightweight framework that empowers you to create modern web applications with lightning speed and flexibility. With EchoNext, you're not just coding; you're building a masterpiece!
6161

62-
> Last stable version: 0.7.17 alpha
62+
> Last stable version: 0.7.18 alpha
6363
6464
> Next Big Update: ASYNC & unicorn support
6565

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ currently being supported with security updates.
77

88
| Version | Supported |
99
|---------|--------------------|
10+
| 0.7.18 | :white_check_mark: |
1011
| 0.7.17 | :white_check_mark: |
1112
| 0.7.16 | :white_check_mark: |
1213
| 0.7.15 | :white_check_mark: |

pyechonext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from rich import print
2323
from rich.traceback import install
2424

25-
__version__ = "0.7.17"
25+
__version__ = "0.7.18"
2626
install(show_locals=True)
2727

2828

pyechonext/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def clean_up(self):
7676
"""
7777
current_time = time.time()
7878
keys_to_delete = [
79-
key for key, entry in self._cache.items() if entry.expire < current_time
79+
key for key, entry in self._cache.items() if entry.expiry < current_time
8080
]
8181

8282
for key in keys_to_delete:

pyechonext/mvc/routes.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,13 @@ def resolve(
240240

241241
url = url if self.prefix is None else f"{self.prefix}{url}"
242242

243-
paths = self._trie.starts_with(url)
244-
245-
print(f"get {url}: {self._trie.starts_with('')}")
246-
247-
for path in paths:
248-
route = self.routes.get(path)
249-
250-
if route is not None:
251-
parse_result = parse.parse(path, url)
252-
if parse_result is not None:
253-
return route, parse_result.named
243+
# Check all routes for pattern matching
244+
for path, route in self.routes.items():
245+
parse_result = parse.parse(path, url)
246+
if parse_result is not None:
247+
return route, parse_result.named
254248

255249
if raise_404:
256250
raise URLNotFound(f'URL "{url}" not found.')
257251
else:
258-
return None, None
252+
return None, None

pyechonext/security/crypts.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,26 @@ def crypt(self, password: str) -> str:
4444
:returns: crypted password
4545
:rtype: str
4646
"""
47+
if not password:
48+
return ""
49+
4750
crypted = " ".join(password).split()
4851
crypted = list(map(ord, crypted))
4952

5053
return ".".join(list(map(lambda x: str(x * self.seed), crypted)))[::-1]
5154

52-
def decrypt(self, crypted: int) -> str:
55+
def decrypt(self, crypted: str) -> str:
5356
"""
5457
Decrypt password
5558
5659
:param crypted: The crypted
57-
:type crypted: int
60+
:type crypted: str
5861
5962
:returns: decrypted value
6063
:rtype: str
6164
"""
65+
if not crypted:
66+
return ""
67+
6268
password = list(map(lambda x: int(x) // self.seed, crypted[::-1].split(".")))
6369
return "".join(list(map(chr, password)))

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyechonext"
3-
version = "0.7.17"
3+
version = "0.7.18"
44
description = "EchoNext is a lightweight, fast and scalable web framework for Python"
55
authors = ["alexeev-prog <[email protected]>"]
66
license = "LGPL-2.1"

tests/test_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
class TestCacheEntry:
77
def test_entry_creation(self):
8-
entry = CacheEntry(name="test", value=42, expire=1000.0)
8+
entry = CacheEntry(name="test", value=42, expiry=1000.0)
99
assert entry.name == "test"
1010
assert entry.value == 42
11-
assert entry.expire == 1000.0
11+
assert entry.expiry == 1000.0
1212

1313
class TestInMemoryCache:
1414
@pytest.fixture

tests/test_trie.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_starts_with(self, trie):
2323

2424
def test_size(self, trie):
2525
assert trie.size() > 0
26-
assert trie.size(trie.root.children['a']) == 4
26+
assert trie.size(trie.root.children['a']) == 20
2727

2828
def test_empty_prefix(self, trie):
2929
assert len(trie.starts_with("")) == 8

0 commit comments

Comments
 (0)