Closed Bug 552281 Opened 14 years ago Closed 13 years ago

Description for "authentication fields" aren't set correctly

Categories

(Webtools :: ISPDB Server, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: JasnaPaka, Assigned: sancus)

References

Details

Attachments

(1 file)

1) Visit http://ispdb.mozillamessaging.com/details/266
2) You can see that fields "Incoming authentication" and "Outgoing authentication" don't have correct description. Text "password-cleartext" is value of option from form.
Attached patch patch v1Splinter Review
Assignee: nobody → sancus
Status: NEW → ASSIGNED
Attachment #503570 - Flags: review?(bwinton)
Comment on attachment 503570 [details] [diff] [review]
patch v1

>Index: config/models.py
>-    ("password-encrypted", "Encrypted Password"),
>+    ("password-encrypted", "Encrypted Password"),   

There are some trailing spaces to remove here.

>+    ("NTLM", "NTLM"),   
>+    ("GSSAPI", "GSSAPI")
>@@ -109,10 +110,11 @@
>+    ("NTLM", "NTLM"),   
>+    ("GSSAPI", "GSSAPI")

You really want the trailing commas on these, so that when you add another item, you don't need to mess with this line, or worse, forget to mess with this line and run into a syntax error.  ;)

>Index: config/templatetags/custom_filters.py
>+@register.filter
>+def data_verbose(boundField):
>+    """
>+    Returns field's data or it's verbose version 
>+    for a field with choices defined.
>+
>+    Usage::
>+
>+        {% load data_verbose %}
>+        {{form.some_field|data_verbose}}
>+    """
>+    data = boundField['value']
>+    field = boundField
>+    return field.has_key('choices') and dict(field['choices']).get(data, '') or data

Bleah.  Python doesn't have the ?: operator, and you're better off not trying to fake it.

Use:
rv = data
if field.has_key("choices"):
    rv = dict(field["choices"]).get(data, "")
return rv
please.

(Also, we're using "s for strings everywhere else, so we might as well keep that consistent here.)

Finally, the rest of the code is PEP-8 clean <http://pypi.python.org/pypi/pep8>, so it would be nice if this was as well.

r=me with those changes.  :)

Thanks,
Blake.
Attachment #503570 - Flags: review?(bwinton) → review+
fixed in r81372
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: ispdb → ISPDB Server
Product: Mozilla Messaging → Webtools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: