#NEWLINE# @ treeio_login_required #NEWLINE# def settings_view( request , response_format = 'html' ) : #NEWLINE# #INDENT# 'Settings view' #NEWLINE# user = request . user . profile #NEWLINE# try : #NEWLINE# #INDENT# conf = ModuleSetting . get_for_module ( 'treeio.core' , 'default_permissions' , user = user ) [ 0 ] #NEWLINE# default_permissions = conf . value #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# default_permissions = settings . HARDTREE_DEFAULT_PERMISSIONS #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# conf = ModuleSetting . get_for_module ( 'treeio.core' , 'default_perspective' , user = user ) [ 0 ] #NEWLINE# default_perspective = Perspective . objects . get ( pk = long ( conf . value ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# default_perspective = None #NEWLINE# #UNINDENT# language = getattr ( settings , 'HARDTREE_LANGUAGES_DEFAULT' , '' ) #NEWLINE# try : #NEWLINE# #INDENT# conf = ModuleSetting . get ( 'language' , user = user ) [ 0 ] #NEWLINE# language = conf . value #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# all_languages = getattr ( settings , 'HARDTREE_LANGUAGES' , [ ( 'en' , 'English' ) ] ) #NEWLINE# default_timezone = settings . HARDTREE_SERVER_DEFAULT_TIMEZONE #NEWLINE# try : #NEWLINE# #INDENT# conf = ModuleSetting . get ( 'default_timezone' ) [ 0 ] #NEWLINE# default_timezone = conf . value #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# conf = ModuleSetting . get ( 'default_timezone' , user = user ) [ 0 ] #NEWLINE# default_timezone = conf . value #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# default_timezone = getattr ( settings , 'HARDTREE_SERVER_TIMEZONE' ) [ default_timezone ] [ 0 ] #NEWLINE# #UNINDENT# all_timezones = getattr ( settings , 'HARDTREE_SERVER_TIMEZONE' ) #NEWLINE# email_notifications = getattr ( settings , 'HARDTREE_ALLOW_EMAIL_NOTIFICATIONS' , False ) #NEWLINE# try : #NEWLINE# #INDENT# conf = ModuleSetting . get ( 'email_notifications' , user = user ) [ 0 ] #NEWLINE# email_notifications = conf . value #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ns = NotificationSetting . objects . get ( owner = user , enabled = True ) #NEWLINE# notifications_for_modules = [ m . title for m in ns . modules . all ( ) ] #NEWLINE# #UNINDENT# except NotificationSetting . DoesNotExist : #NEWLINE# #INDENT# notifications_for_modules = [ ] #NEWLINE# #UNINDENT# return render_to_response ( 'account/settings_view' , { #NEWLINE# #INDENT# 'default_permissions' : default_permissions , #NEWLINE# 'default_perspective' : response_format , #NEWLINE# 'language' : language , #NEWLINE# 'all_languages' : all_languages , #NEWLINE# 'default_timezone' : default_timezone , #NEWLINE# 'all_timezones' : all_timezones , #NEWLINE# 'email_notifications' : email_notifications , #NEWLINE# 'notifications_for_modules' : notifications_for_modules , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) , response_format = response_format )