Development

Changeset 4296

You must first sign up to be able to contribute.

Changeset 4296

Show
Ignore:
Timestamp:
06/20/07 22:29:55 (1 year ago)
Author:
dwhittle
Message:

dwhittle: merging trunk + routing changes to my branch (revs 4271:4295)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dwhittle/lib/action/sfAction.class.php

    r4271 r4296  
    291291   */ 
    292292  public function renderMultiformat($format_param = 'format', $accepted_formats = array()) 
    293   { 
    294     // FIXME: Make the exceptions of this method redirect to a 404 in production 
    295      
     293  {  
    296294    if(!$format = $this->getRequestParameter($format_param)) 
    297295    { 
    298       throw new sfException(sprintf('The format parameter "%s" is not defined in the request', $format_param)); 
     296      throw new sfError404Exception(sprintf('The format parameter "%s" is not defined in the request', $format_param)); 
    299297    } 
    300298     
     
    304302    { 
    305303      // format not in the list of allowed formats 
    306       throw new sfException(sprintf('The format "%s" is not allowed in this action. If you want to use this format, add it to the list of allowed formats in the second argument of the call to renderMultiformat()', $format)); 
     304      throw new sfError404Exception(sprintf('The format "%s" is not allowed in this action. If you want to use this format, add it to the list of allowed formats in the second argument of the call to renderMultiformat()', $format)); 
    307305    } 
    308306     
     
    313311      if(!isset($default_classes[$format])) 
    314312      { 
    315         throw new sfException(sprintf('There is no default view for format "%s". You can define one in the settings.yml file, under the multiformat: label.', $format)); 
     313        throw new sfError404Exception(sprintf('There is no default view for format "%s". You can define one in the settings.yml file, under the multiformat: label.', $format)); 
    316314      } 
    317315      $this->setViewClass($default_classes[$format]); 
  • branches/dwhittle/lib/config/sfLoader.class.php

    r3328 r4296  
    167167  static public function getGeneratorTemplateDirs($class, $theme) 
    168168  { 
    169     $dirs = array(); 
     169    $dirs = array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/template');                  // project 
    170170 
    171171    if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/data/generator/'.$class.'/'.$theme.'/template')) 
     
    174174    } 
    175175 
    176     $dirs[] = sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/template';                       // project 
    177176    $dirs[] = sfConfig::get('sf_symfony_data_dir').'/generator/'.$class.'/default/template';                  // default theme 
    178177 
     
    190189  static public function getGeneratorSkeletonDirs($class, $theme) 
    191190  { 
    192     $dirs = array(); 
     191    $dirs = array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/skeleton');                  // project 
    193192 
    194193    if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/data/generator/'.$class.'/'.$theme.'/skeleton')) 
     
    197196    } 
    198197 
    199     $dirs[] = sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/skeleton';                       // project 
    200198    $dirs[] = sfConfig::get('sf_symfony_data_dir').'/generator/'.$class.'/default/skeleton';                  // default theme 
    201199 
  • branches/dwhittle/lib/exception/sfError404Exception.class.php

    r3248 r4296  
    3838  public function printStackTrace($exception = null) 
    3939  { 
    40     sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 
     40    if (sfConfig::get('sf_debug')) 
     41    { 
     42      return parent::printStackTrace($exception); 
     43    } 
     44    else 
     45    { 
     46      sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 
     47    } 
    4148  } 
    4249} 
  • branches/dwhittle/lib/i18n/sfMessageFormat.class.php

    r3112 r4296  
    6060   * @var array 
    6161   */ 
    62   protected $catagloues = array(); 
     62  protected $catalogues = array(); 
    6363 
    6464  /** 
     
    136136  protected function loadCatalogue($catalogue) 
    137137  { 
    138     if (in_array($catalogue,$this->catagloues)) 
     138    if (in_array($catalogue,$this->catalogues)) 
    139139    { 
    140140      return; 
     
    144144    { 
    145145      $this->messages[$catalogue] = $this->source->read(); 
    146       $this->catagloues[] = $catalogue; 
     146      $this->catalogues[] = $catalogue; 
    147147    } 
    148148  } 
  • branches/dwhittle/lib/i18n/sfMessageSource_MySQL.class.php

    r4249 r4296  
    4747   * @var array  
    4848   */ 
    49   protected $dns
     49  protected $dsn
    5050 
    5151  /** 
     
    6565  { 
    6666    $this->source = (string)$source; 
    67     $this->dns = parseDSN($this->source); 
     67    $this->dsn = parseDSN($this->source); 
    6868    $this->db = $this->connect(); 
    6969  } 
     
    8585  protected function connect() 
    8686  { 
    87     $dsninfo = $this->dns
     87    $dsninfo = $this->dsn
    8888 
    8989    if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') 
     
    130130      if (!@mysql_select_db($dsninfo['database'], $conn)) 
    131131      { 
    132         throw new sfException('Error in connecting database, dns:'.$dsninfo); 
     132        throw new sfException('Error in connecting database, dsn:'.$dsninfo); 
    133133      } 
    134134    } 
  • branches/dwhittle/lib/util/sfBrowser.class.php

    r3688 r4296  
    208208      $this->domCssSelector = new sfDomCssSelector($this->dom); 
    209209    } 
     210    else 
     211    { 
     212      $this->dom = null; 
     213      $this->domCssSelector = null; 
     214    } 
    210215 
    211216    return $this; 
     
    246251  public function getResponseDomCssSelector() 
    247252  { 
     253    if (is_null($this->dom)) 
     254    { 
     255      throw new sfException('The DOM is not accessible because the browser response content type is not HMTL.'); 
     256    } 
     257 
    248258    return $this->domCssSelector; 
    249259  } 
     
    251261  public function getResponseDom() 
    252262  { 
     263    if (is_null($this->dom)) 
     264    { 
     265      throw new sfException('The DOM is not accessible because the browser response content type is not HMTL.'); 
     266    } 
     267 
    253268    return $this->dom; 
    254269  } 
     
    295310  public function click($name, $arguments = array()) 
    296311  { 
    297     if (!$this->dom) 
     312    $dom = $this->getResponseDom(); 
     313 
     314    if (!$dom) 
    298315    { 
    299316      throw new sfException('Cannot click because there is no current page in the browser'); 
    300317    } 
    301318 
    302     $xpath = new DomXpath($this->dom); 
    303     $dom   = $this->dom; 
     319    $xpath = new DomXpath($dom); 
    304320 
    305321    // text link 
  • branches/dwhittle/lib/validator/sfValidatorManager.class.php

    r3248 r4296  
    255255      ($data['is_file'] && !$value['name']) 
    256256      || 
    257       (!$data['is_file'] && (is_array($value) ? sfToolkit::isArrayValuesEmpty($value) : ($value == null || strlen($value) == 0))) 
     257      (!$data['is_file'] && (is_array($value) ? sfToolkit::isArrayValuesEmpty($value) : ($value === null || strlen($value) == 0))) 
    258258    ) 
    259259    { 
  • branches/dwhittle/test/functional/routingTest.php

    r4271 r4296  
    119119$b-> 
    120120  get('/test_multiformat.titi')-> 
     121  responseContains('sfError404Exception')-> 
    121122  responseContains('There is no default view for format "titi"') 
    122123; 
    123124$b-> 
    124125  get('/test_multiformat.toto')-> 
     126  responseContains('sfError404Exception')-> 
    125127  responseContains('The format "toto" is not allowed in this action') 
    126128; 
     
    145147$b-> 
    146148  get('/test_multiformat_defaults.toto')-> 
     149  responseContains('sfError404Exception')-> 
    147150  responseContains('There is no default view for format "toto"') 
    148151; 
     
    153156  isRequestParameter('module', 'test')-> 
    154157  isRequestParameter('action', 'testMultiformatUndefined')-> 
     158  responseContains('sfError404Exception')-> 
    155159  responseContains('The format parameter "format" is not defined in the request') 
    156160; 
  • branches/dwhittle/test/functional/sfTestBrowserTest.php

    r3112 r4296  
    4242  throwsException('sfException', 'sfException message') 
    4343; 
     44 
     45$b-> 
     46  get('/browser')-> 
     47  responseContains('html')-> 
     48  checkResponseElement('h1', 'html')-> 
     49 
     50  get('/browser/text')-> 
     51  responseContains('text') 
     52; 
     53 
     54try 
     55{ 
     56  $b->checkResponseElement('h1', 'text'); 
     57  $b->test()->fail('The DOM is not accessible if the response content type is not HTML'); 
     58} 
     59catch (sfException $e) 
     60{ 
     61  $b->test()->pass('The DOM is not accessible if the response content type is not HTML'); 
     62}