~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/dispatch/request.py

Purge most of ivle.dispatch.html and even more of ivle.conf.apps, as lots is
unused.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
import ivle.util
37
37
import ivle.conf
38
38
import ivle.database
39
 
import plugins.console # XXX: Relies on www/ being in the Python path.
 
39
from ivle.webapp.base.plugins import CookiePlugin
40
40
 
41
41
class Request:
42
42
    """An IVLE request object. This is presented to the IVLE apps as a way of
236
236
        except KeyError:
237
237
            app = None
238
238
 
239
 
        # Write any final modifications to header content
240
 
        if app and app.useconsole and self.user:
241
 
            plugins.console.insert_scripts_styles(self.scripts, self.styles, \
242
 
                self.scripts_init)
243
 
 
244
239
        # Prepare the HTTP and HTML headers before the first write is made
245
240
        if self.content_type != None:
246
241
            self.apache_req.content_type = self.content_type
275
270
    def logout(self):
276
271
        """Log out the current user by destroying the session state.
277
272
        Then redirect to the top-level IVLE page."""
278
 
        # List of cookies that IVLE uses (to be removed at logout)
279
 
        ivle_cookies = ["ivleforumcookie", "clipboard"]
280
 
        
281
273
        if hasattr(self, 'session'):
282
274
            self.session.invalidate()
283
275
            self.session.delete()
284
276
            # Invalidates all IVLE cookies
285
277
            all_cookies = mod_python.Cookie.get_cookies(self)
286
 
            for cookie in all_cookies:
287
 
                if cookie in ivle_cookies:
288
 
                    self.add_cookie(mod_python.Cookie.Cookie(cookie,'',expires=1,path='/'))
 
278
 
 
279
            # Create cookies for plugins that might request them.
 
280
            for plugin in self.plugin_index[CookiePlugin]:
 
281
                for cookie in plugin.cookies:
 
282
                    self.add_cookie(mod_python.Cookie.Cookie(cookie, '',
 
283
                                                    expires=1, path='/'))
289
284
        self.throw_redirect(ivle.util.make_path('')) 
290
285
 
291
286