Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
get_random_string removed
Browse files Browse the repository at this point in the history
  • Loading branch information
zalun committed Oct 1, 2010
1 parent 9b98cd0 commit 5a26401
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
6 changes: 0 additions & 6 deletions flightdeck/base/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,3 @@ def get_object_with_related_or_404(klass, *args, **kwargs):
except queryset.model.DoesNotExist:
raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)

def get_random_string(number=10, prefix=''):
allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'
if prefix:
prefix = '%s-' % prefix
return '%s%s' % (prefix, ''.join([choice(allowed_chars) for i in range(number)]))

8 changes: 4 additions & 4 deletions flightdeck/jetpack/package_helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from base.shortcuts import get_object_or_create, get_object_with_related_or_404, get_random_string
from jetpack.models import Package, PackageRevision
from base.shortcuts import get_object_with_related_or_404
from jetpack.models import Package, PackageRevision

def get_package_revision(id, type, revision_number=None, version_name=None, latest=False):
"""
Expand All @@ -12,12 +12,12 @@ def get_package_revision(id, type, revision_number=None, version_name=None, late

elif revision_number:
# get version given by revision number
package_revision = get_object_with_related_or_404(PackageRevision,
package_revision = get_object_with_related_or_404(PackageRevision,
package__id_number=id, package__type=type,
revision_number=revision_number)
elif version_name:
# get version given by version name
package_revision = get_object_with_related_or_404(PackageRevision,
package_revision = get_object_with_related_or_404(PackageRevision,
package__id_number=id, package__type=type,
version_name=version_name)
return package_revision
Expand Down
10 changes: 0 additions & 10 deletions flightdeck/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
from random import choice

CHARS='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'

def random_string(length=10, prefix=''):
random_length = length - len(prefix)
if random_length <= 0:
return prefix
return (prefix + ''.join([choice(CHARS) for i in range(random_length)]))[0:length]

0 comments on commit 5a26401

Please sign in to comment.