goa/appobjects/dbmgmt.py
branchtls-sprint
changeset 1802 d628defebc17
parent 1398 5fe84a5f7035
child 1977 606923dff11b
equal deleted inserted replaced
1801:672acc730ce5 1802:d628defebc17
    52                     values.append('%s=%s' % (param, morsel.value))
    52                     values.append('%s=%s' % (param, morsel.value))
    53                     break
    53                     break
    54         values.append('__session=%s' % cookie['__session'].value)
    54         values.append('__session=%s' % cookie['__session'].value)
    55         self.w(u"<p>pass this flag to the client: --cookie='%s'</p>"
    55         self.w(u"<p>pass this flag to the client: --cookie='%s'</p>"
    56                % html_escape('; '.join(values)))
    56                % html_escape('; '.join(values)))
    57         
    57 
    58         
    58 
    59 
    59 
    60 class ContentInit(StartupView):
    60 class ContentInit(StartupView):
    61     """special management view to initialize content of a repository,
    61     """special management view to initialize content of a repository,
    62     step by step to avoid depassing quotas
    62     step by step to avoid depassing quotas
    63     """
    63     """
    72     def end_core_step(self, msg, status, stepid):
    72     def end_core_step(self, msg, status, stepid):
    73         status['cpath'] = ''
    73         status['cpath'] = ''
    74         status['stepid'] = stepid
    74         status['stepid'] = stepid
    75         Put(status)
    75         Put(status)
    76         self.msg(msg)
    76         self.msg(msg)
    77         
    77 
    78     def call(self):
    78     def call(self):
    79         status = _get_status('creation')
    79         status = _get_status('creation')
    80         if status.get('finished'):
    80         if status.get('finished'):
    81             self.redirect('process already completed')
    81             self.redirect('process already completed')
    82         config = self.config
    82         config = self.config
   147                          % cpath)
   147                          % cpath)
   148                 self.w(u'<div>click <a href="%s?vid=contentclear">here</a> to '
   148                 self.w(u'<div>click <a href="%s?vid=contentclear">here</a> to '
   149                        '<b>delete all datastore content</b> so process can be '
   149                        '<b>delete all datastore content</b> so process can be '
   150                        'reinitialized</div>' % html_escape(self.req.base_url()))
   150                        'reinitialized</div>' % html_escape(self.req.base_url()))
   151         Put(status)
   151         Put(status)
   152         
   152 
   153     @property
   153     @property
   154     @cached
   154     @cached
   155     def _migrhandler(self):
   155     def _migrhandler(self):
   156         return self.config.migration_handler(self.schema, interactive=False,
   156         return self.config.migration_handler(self.schema, interactive=False,
   157                                              cnx=self.req.cnx,
   157                                              cnx=self.req.cnx,
   162     def redirect(self, msg):
   162     def redirect(self, msg):
   163         raise Redirect(self.req.build_url('', msg))
   163         raise Redirect(self.req.build_url('', msg))
   164     def continue_link(self):
   164     def continue_link(self):
   165         self.w(u'<a href="%s">continue</a><br/>' % html_escape(self.req.url()))
   165         self.w(u'<a href="%s">continue</a><br/>' % html_escape(self.req.url()))
   166 
   166 
   167         
   167 
   168 class ContentClear(StartupView):
   168 class ContentClear(StartupView):
   169     id = 'contentclear'
   169     id = 'contentclear'
   170     __select__ = none_rset() & match_user_groups('managers')
   170     __select__ = none_rset() & match_user_groups('managers')
   171     skip_etypes = ('CWGroup', 'CWUser')
   171     skip_etypes = ('CWGroup', 'CWUser')
   172     
   172 
   173     def call(self):
   173     def call(self):
   174         # XXX should use unsafe_execute with all hooks deactivated
   174         # XXX should use unsafe_execute with all hooks deactivated
   175         # XXX step by catching datastore errors?
   175         # XXX step by catching datastore errors?
   176         for eschema in self.schema.entities():
   176         for eschema in self.schema.entities():
   177             if eschema.is_final() or eschema in self.skip_etypes:
   177             if eschema.is_final() or eschema in self.skip_etypes: