Skip to content

Commit

Permalink
prevents you from
Browse files Browse the repository at this point in the history
AttributeError: 'NoneType' object has no attribute 'get' (the none object is "attrs")

other possibility:
if attrs is not None:
    self.attrs = attrs.copy()
else:
    self.attrs = {}

seen @ django.forms.widgets.Widget
  • Loading branch information
fetzig committed Feb 2, 2012
1 parent 4dc70aa commit c0c78b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion filebrowser/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FileBrowseWidget(Input):
class Media:
js = (os.path.join(URL_FILEBROWSER_MEDIA, 'js/AddFileBrowser.js'), )

def __init__(self, attrs=None):
def __init__(self, attrs={}):
super(FileBrowseWidget, self).__init__(attrs)
self.site = attrs.get('filebrowser_site', None)
self.directory = attrs.get('directory', '')
Expand Down

0 comments on commit c0c78b0

Please sign in to comment.