Skip to content

Commit

Permalink
Merge branch 'use-modern-form-of-imports' of https://github.com/basep…
Browse files Browse the repository at this point in the history
…late-admin/django-ltree-2 into use-modern-form-of-imports
  • Loading branch information
baseplate-admin committed Feb 22, 2024
2 parents b6acb26 + 5cf4b36 commit 7941e7e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions django_ltree/paths.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import string
from itertools import product

from django_ltree.fields import PathValue


class PathGenerator(object):
_alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
_default_label_size = 6 # Postgres limits this to 256

def __init__(self, prefix=None, skip=None, label_size=None):
self.skip_paths = [] if skip is None else skip[:]
self.path_prefix = prefix if prefix else []
self.product_iterator = product(
self._alphabet, repeat=label_size or self._default_label_size
string.digits + string.ascii_letters,
repeat=label_size or self._default_label_size,
)

def __iter__(self):
Expand Down

0 comments on commit 7941e7e

Please sign in to comment.