Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
8f04f53d
Kaydet (Commit)
8f04f53d
authored
Ara 26, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed a few gratuitous lambdas.
üst
4e7aa573
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
20 deletions
+37
-20
options.py
django/contrib/admin/options.py
+5
-2
admin_list.py
django/contrib/admin/templatetags/admin_list.py
+1
-1
forms.py
django/contrib/auth/forms.py
+5
-1
__init__.py
django/contrib/messages/storage/__init__.py
+9
-5
options.py
django/db/models/options.py
+3
-5
text.py
django/utils/text.py
+10
-0
runtests.py
tests/runtests.py
+4
-6
No files found.
django/contrib/admin/options.py
Dosyayı görüntüle @
8f04f53d
...
@@ -46,9 +46,12 @@ from django.views.decorators.csrf import csrf_protect
...
@@ -46,9 +46,12 @@ from django.views.decorators.csrf import csrf_protect
IS_POPUP_VAR
=
'_popup'
IS_POPUP_VAR
=
'_popup'
TO_FIELD_VAR
=
'_to_field'
TO_FIELD_VAR
=
'_to_field'
HORIZONTAL
,
VERTICAL
=
1
,
2
HORIZONTAL
,
VERTICAL
=
1
,
2
# returns the <ul> class for a given radio_admin field
get_ul_class
=
lambda
x
:
'radiolist
%
s'
%
(
' inline'
if
x
==
HORIZONTAL
else
''
)
def
get_ul_class
(
radio_style
):
return
'radiolist'
if
radio_style
==
VERTICAL
else
'radiolist inline'
class
IncorrectLookupParameters
(
Exception
):
class
IncorrectLookupParameters
(
Exception
):
...
...
django/contrib/admin/templatetags/admin_list.py
Dosyayı görüntüle @
8f04f53d
...
@@ -333,7 +333,7 @@ def date_hierarchy(cl):
...
@@ -333,7 +333,7 @@ def date_hierarchy(cl):
month_lookup
=
cl
.
params
.
get
(
month_field
)
month_lookup
=
cl
.
params
.
get
(
month_field
)
day_lookup
=
cl
.
params
.
get
(
day_field
)
day_lookup
=
cl
.
params
.
get
(
day_field
)
link
=
lambda
d
:
cl
.
get_query_string
(
d
,
[
field_generic
])
link
=
lambda
filters
:
cl
.
get_query_string
(
filters
,
[
field_generic
])
if
not
(
year_lookup
or
month_lookup
or
day_lookup
):
if
not
(
year_lookup
or
month_lookup
or
day_lookup
):
# select appropriate start level
# select appropriate start level
...
...
django/contrib/auth/forms.py
Dosyayı görüntüle @
8f04f53d
...
@@ -21,7 +21,11 @@ from django.contrib.sites.models import get_current_site
...
@@ -21,7 +21,11 @@ from django.contrib.sites.models import get_current_site
UNMASKED_DIGITS_TO_SHOW
=
6
UNMASKED_DIGITS_TO_SHOW
=
6
mask_password
=
lambda
p
:
"
%
s
%
s"
%
(
p
[:
UNMASKED_DIGITS_TO_SHOW
],
"*"
*
max
(
len
(
p
)
-
UNMASKED_DIGITS_TO_SHOW
,
0
))
def
mask_password
(
password
):
shown
=
password
[:
UNMASKED_DIGITS_TO_SHOW
]
masked
=
"*"
*
max
(
len
(
password
)
-
UNMASKED_DIGITS_TO_SHOW
,
0
)
return
shown
+
masked
class
ReadOnlyPasswordHashWidget
(
forms
.
Widget
):
class
ReadOnlyPasswordHashWidget
(
forms
.
Widget
):
...
...
django/contrib/messages/storage/__init__.py
Dosyayı görüntüle @
8f04f53d
from
django.conf
import
settings
from
django.conf
import
settings
from
django.utils.module_loading
import
import_by_path
as
get_storage
from
django.utils.module_loading
import
import_by_path
# Callable with the same interface as the storage classes i.e. accepts a
def
default_storage
(
request
):
# 'request' object. It is wrapped in a lambda to stop 'settings' being used at
"""
# the module level
Callable with the same interface as the storage classes.
default_storage
=
lambda
request
:
get_storage
(
settings
.
MESSAGE_STORAGE
)(
request
)
This isn't just default_storage = import_by_path(settings.MESSAGE_STORAGE)
to avoid accessing the settings at the module level.
"""
return
import_by_path
(
settings
.
MESSAGE_STORAGE
)(
request
)
django/db/models/options.py
Dosyayı görüntüle @
8f04f53d
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
collections
import
OrderedDict
import
re
from
bisect
import
bisect
from
bisect
import
bisect
from
collections
import
OrderedDict
import
warnings
import
warnings
from
django.apps
import
apps
from
django.apps
import
apps
...
@@ -13,10 +12,9 @@ from django.db.models.fields.proxy import OrderWrt
...
@@ -13,10 +12,9 @@ from django.db.models.fields.proxy import OrderWrt
from
django.utils
import
six
from
django.utils
import
six
from
django.utils.functional
import
cached_property
from
django.utils.functional
import
cached_property
from
django.utils.encoding
import
force_text
,
smart_text
,
python_2_unicode_compatible
from
django.utils.encoding
import
force_text
,
smart_text
,
python_2_unicode_compatible
from
django.utils.text
import
camel_case_to_spaces
from
django.utils.translation
import
activate
,
deactivate_all
,
get_language
,
string_concat
from
django.utils.translation
import
activate
,
deactivate_all
,
get_language
,
string_concat
# Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces".
get_verbose_name
=
lambda
class_name
:
re
.
sub
(
'(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))'
,
'
\\
1'
,
class_name
)
.
lower
()
.
strip
()
DEFAULT_NAMES
=
(
'verbose_name'
,
'verbose_name_plural'
,
'db_table'
,
'ordering'
,
DEFAULT_NAMES
=
(
'verbose_name'
,
'verbose_name_plural'
,
'db_table'
,
'ordering'
,
'unique_together'
,
'permissions'
,
'get_latest_by'
,
'unique_together'
,
'permissions'
,
'get_latest_by'
,
...
@@ -109,7 +107,7 @@ class Options(object):
...
@@ -109,7 +107,7 @@ class Options(object):
# First, construct the default values for these options.
# First, construct the default values for these options.
self
.
object_name
=
cls
.
__name__
self
.
object_name
=
cls
.
__name__
self
.
model_name
=
self
.
object_name
.
lower
()
self
.
model_name
=
self
.
object_name
.
lower
()
self
.
verbose_name
=
get_verbose_name
(
self
.
object_name
)
self
.
verbose_name
=
camel_case_to_spaces
(
self
.
object_name
)
# Store the original user-defined values for each option,
# Store the original user-defined values for each option,
# for use when serializing the model definition
# for use when serializing the model definition
...
...
django/utils/text.py
Dosyayı görüntüle @
8f04f53d
...
@@ -17,6 +17,7 @@ if six.PY2:
...
@@ -17,6 +17,7 @@ if six.PY2:
# people rely on it being here.
# people rely on it being here.
from
django.utils.encoding
import
force_unicode
# NOQA
from
django.utils.encoding
import
force_unicode
# NOQA
# Capitalizes the first letter of a string.
# Capitalizes the first letter of a string.
capfirst
=
lambda
x
:
x
and
force_text
(
x
)[
0
]
.
upper
()
+
force_text
(
x
)[
1
:]
capfirst
=
lambda
x
:
x
and
force_text
(
x
)[
0
]
.
upper
()
+
force_text
(
x
)[
1
:]
capfirst
=
allow_lazy
(
capfirst
,
six
.
text_type
)
capfirst
=
allow_lazy
(
capfirst
,
six
.
text_type
)
...
@@ -25,6 +26,7 @@ capfirst = allow_lazy(capfirst, six.text_type)
...
@@ -25,6 +26,7 @@ capfirst = allow_lazy(capfirst, six.text_type)
re_words
=
re
.
compile
(
r'<.*?>|((?:\w[-\w]*|&.*?;)+)'
,
re
.
U
|
re
.
S
)
re_words
=
re
.
compile
(
r'<.*?>|((?:\w[-\w]*|&.*?;)+)'
,
re
.
U
|
re
.
S
)
re_tag
=
re
.
compile
(
r'<(/)?([^ ]+?)(?:(\s*/)| .*?)?>'
,
re
.
S
)
re_tag
=
re
.
compile
(
r'<(/)?([^ ]+?)(?:(\s*/)| .*?)?>'
,
re
.
S
)
re_newlines
=
re
.
compile
(
r'\r\n|\r'
)
# Used in normalize_newlines
re_newlines
=
re
.
compile
(
r'\r\n|\r'
)
# Used in normalize_newlines
re_camel_case
=
re
.
compile
(
r'(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))'
)
def
wrap
(
text
,
width
):
def
wrap
(
text
,
width
):
...
@@ -420,3 +422,11 @@ def slugify(value):
...
@@ -420,3 +422,11 @@ def slugify(value):
value
=
re
.
sub
(
'[^
\
w
\
s-]'
,
''
,
value
)
.
strip
()
.
lower
()
value
=
re
.
sub
(
'[^
\
w
\
s-]'
,
''
,
value
)
.
strip
()
.
lower
()
return
mark_safe
(
re
.
sub
(
'[-
\
s]+'
,
'-'
,
value
))
return
mark_safe
(
re
.
sub
(
'[-
\
s]+'
,
'-'
,
value
))
slugify
=
allow_lazy
(
slugify
,
six
.
text_type
)
slugify
=
allow_lazy
(
slugify
,
six
.
text_type
)
def
camel_case_to_spaces
(
value
):
"""
Splits CamelCase and converts to lower case. Also strips leading and
trailing whitespace.
"""
return
re_camel_case
.
sub
(
r' \1'
,
value
)
.
strip
()
.
lower
()
tests/runtests.py
Dosyayı görüntüle @
8f04f53d
...
@@ -154,12 +154,10 @@ def setup(verbosity, test_labels):
...
@@ -154,12 +154,10 @@ def setup(verbosity, test_labels):
if
not
test_labels
:
if
not
test_labels
:
module_found_in_labels
=
True
module_found_in_labels
=
True
else
:
else
:
match
=
lambda
label
:
(
module_found_in_labels
=
any
(
module_label
==
label
or
# exact match
# exact match or ancestor match
module_label
.
startswith
(
label
+
'.'
)
# ancestor match
module_label
==
label
or
module_label
.
startswith
(
label
+
'.'
)
)
for
label
in
test_labels_set
)
module_found_in_labels
=
any
(
match
(
l
)
for
l
in
test_labels_set
)
if
module_found_in_labels
:
if
module_found_in_labels
:
if
verbosity
>=
2
:
if
verbosity
>=
2
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment