Package base :: Module index
[hide private]

Source Code for Module base.index

 1  #!/usr/bin/env python 
 2  # $Id: index.php,v 1.94 2007/12/26 08:46:48 dries Exp $ 
 3   
 4  """ 
 5    The Python page that serves all page requests on a Drupy installation. 
 6    The routines here dispatch control to the appropriate handler, which then 
 7    prints the appropriate page. 
 8   
 9    @package default 
10    @see <a href='http://drupy.net'>Drupy Homepage</a> 
11    @see <a href='http://drupal.org'>Drupal Homepage</a> 
12    @note Drupy is a port of the Drupal project. 
13    @note This file was ported from Drupal's index.php 
14    @note 
15      THIS FILE IS NOT FUNCTIONAL. 
16      TO SEE A RUNNING INSTANCE OF DRUPY. 
17      PLEASE RUN DRUPY.PY AS A CGI OR CLI 
18    @author Brendon Crawford 
19    @copyright 2008 Brendon Crawford 
20    @contact message144 at users dot sourceforge dot net 
21    @created 2008-01-10 
22    @version 0.1 
23    @note License: 
24   
25      This program is free software; you can redistribute it and/or 
26      modify it under the terms of the GNU General Public License 
27      as published by the Free Software Foundation; either version 2 
28      of the License, or (at your option) any later version. 
29   
30      This program is distributed in the hope that it will be useful, 
31      but WITHOUT ANY WARRANTY; without even the implied warranty of 
32      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
33      GNU General Public License for more details. 
34   
35      You should have received a copy of the GNU General Public License 
36      along with this program; if not, write to: 
37       
38      The Free Software Foundation, Inc., 
39      51 Franklin Street, Fifth Floor, 
40      Boston, MA  02110-1301, 
41      USA 
42  """ 
43   
44  __version__ = "$Revision: 1 $" 
45   
46  from lib.drupy import DrupyPHP as php 
47  from includes import bootstrap as lib_bootstrap 
48  from includes import menu as lib_menu 
49  from includes import common as lib_common 
50  from includes import theme as lib_theme 
51   
52  print 
53  print "THIS FILE IS NOT FUNCTIONAL" 
54  print "TO SEE A RUNNING INSTANCE OF DRUPY" 
55  print "PLEASE RUN DRUPY.PY AS A CGI OR CLI" 
56  print 
57  php.flush() 
58  exit(1) 
59   
60   
61  # 
62  # We need to catch all exceptions and send them to the 
63  # default exception handler 
64  # 
65  drupal_bootstrap(lib_bootstrap.DRUPAL_BOOTSTRAP_FULL); 
66  return_ = lib_menu.execute_active_handler(); 
67  # Menu status constants are integers; page content is a string. 
68  if (is_int(return_)): 
69    if (return_ == lib_menu.MENU_NOT_FOUND): 
70        lib_bootstrap.drupal_not_found(); 
71    elif (return_ == lib_menu.MENU_ACCESS_DENIED): 
72      lib_common.drupal_access_denied(); 
73    elif (return_ == lib_menu.MENU_SITE_OFFLINE): 
74      lib_common.drupal_site_offline(); 
75  else: 
76    # Print any value (including an empty string) except NULL or undefined: 
77    print lib_theme.theme('page', return_); 
78  lib_common.drupal_page_footer(); 
79   
80  # 
81  # Flush the output 
82  # 
83  php.flush() 
84