src/pyams_content/shared/view/interfaces/__init__.py
changeset 337 9a3e4f9cc8f5
parent 96 120f7842a8cb
child 382 f6b688877716
equal deleted inserted replaced
336:d9f37252a42d 337:9a3e4f9cc8f5
    71 
    71 
    72     limit = Int(title=_("Results count limit"),
    72     limit = Int(title=_("Results count limit"),
    73                 description=_("Maximum number of results that the view may retrieve"),
    73                 description=_("Maximum number of results that the view may retrieve"),
    74                 required=False)
    74                 required=False)
    75 
    75 
       
    76     is_using_context = Attribute("Check if view is using context settings")
       
    77 
    76     def get_results(self, context):
    78     def get_results(self, context):
    77         """Get results of catalog query"""
    79         """Get results of catalog query"""
    78 
    80 
    79 
    81 
    80 class IView(ISharedContent):
    82 class IView(ISharedContent):
    81     """Workflow managed view interface"""
    83     """Workflow managed view interface"""
       
    84 
       
    85 
       
    86 class IViewSettings(Interface):
       
    87     """Base interface for view settings adapters"""
       
    88 
       
    89     is_using_context = Attribute("Check if view settings are using context")
    82 
    90 
    83 
    91 
    84 class IViewQuery(Interface):
    92 class IViewQuery(Interface):
    85     """View query interface"""
    93     """View query interface"""
    86 
    94 
   126 
   134 
   127 REFERENCES_MODES_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t)
   135 REFERENCES_MODES_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t)
   128                                                 for v, t in REFERENCES_MODES.items()])
   136                                                 for v, t in REFERENCES_MODES.items()])
   129 
   137 
   130 
   138 
   131 class IViewInternalReferencesSettings(IInternalReferencesList):
   139 class IViewInternalReferencesSettings(IViewSettings, IInternalReferencesList):
   132     """View internal references settings"""
   140     """View internal references settings"""
   133 
   141 
   134     references_mode = Choice(title=_("Internal references usage"),
   142     references_mode = Choice(title=_("Internal references usage"),
   135                              description=_("Specify how selected references are included into view results"),
   143                              description=_("Specify how selected references are included into view results"),
   136                              vocabulary=REFERENCES_MODES_VOCABULARY,
   144                              vocabulary=REFERENCES_MODES_VOCABULARY,
   139 
   147 
   140 
   148 
   141 VIEW_THEMES_SETTINGS_KEY = 'pyams_content.view.themes'
   149 VIEW_THEMES_SETTINGS_KEY = 'pyams_content.view.themes'
   142 
   150 
   143 
   151 
   144 class IViewThemesSettings(Interface):
   152 class IViewThemesSettings(IViewSettings):
   145     """View themess ettings"""
   153     """View themess ettings"""
   146 
   154 
   147     select_context_themes = Bool(title=_("Select context themes?"),
   155     select_context_themes = Bool(title=_("Select context themes?"),
   148                                  description=_("If 'yes', themes will be extracted from context"),
   156                                  description=_("If 'yes', themes will be extracted from context"),
   149                                  required=True,
   157                                  required=True,