magic-removal: Unabstracted get_module_name() function, because it was only used once
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e8b570c3c6
commit
8ec8a8720e
|
@ -6,9 +6,6 @@ from django.db.models.query import orderlist2sql
|
||||||
from bisect import bisect
|
from bisect import bisect
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# Calculate the module_name by converting to lowercase
|
|
||||||
get_module_name = lambda class_name: class_name.lower()
|
|
||||||
|
|
||||||
# Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces".
|
# Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces".
|
||||||
get_verbose_name = lambda class_name: re.sub('([A-Z])', ' \\1', class_name).lower().strip()
|
get_verbose_name = lambda class_name: re.sub('([A-Z])', ' \\1', class_name).lower().strip()
|
||||||
|
|
||||||
|
@ -49,7 +46,7 @@ class Options:
|
||||||
def contribute_to_class(self, cls, name):
|
def contribute_to_class(self, cls, name):
|
||||||
cls._meta = self
|
cls._meta = self
|
||||||
self.object_name = cls.__name__
|
self.object_name = cls.__name__
|
||||||
self.module_name = get_module_name(self.object_name)
|
self.module_name = self.object_name.lower()
|
||||||
# If the verbose_name wasn't given, use the class name,
|
# If the verbose_name wasn't given, use the class name,
|
||||||
# converted from "InitialCaps" to "lowercase with spaces".
|
# converted from "InitialCaps" to "lowercase with spaces".
|
||||||
self.verbose_name = get_verbose_name(self.object_name)
|
self.verbose_name = get_verbose_name(self.object_name)
|
||||||
|
|
Loading…
Reference in New Issue