<s> from __future__ import unicode_literals <EOL> import frappe <EOL> from frappe . model . document import Document <EOL> class PortalSettings ( Document ) : <EOL> def add_item ( self , item ) : <EOL> '''<STR_LIT>''' <EOL> if not item . get ( '<STR_LIT>' ) in [ d . route for d in self . get ( '<STR_LIT>' , [ ] ) ] : <EOL> item [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> self . append ( '<STR_LIT>' , item ) <EOL> return True <EOL> def reset ( self ) : <EOL> '''<STR_LIT>''' <EOL> self . menu = [ ] <EOL> self . sync_menu ( ) <EOL> def sync_menu ( self ) : <EOL> '''<STR_LIT>''' <EOL> dirty = False <EOL> for item in frappe . get_hooks ( '<STR_LIT>' ) : <EOL> if self . add_item ( item ) : <EOL> dirty = True <EOL> if dirty : <EOL> self . save ( ) </s>
