anewt-developers team mailing list archive
-
anewt-developers team
-
Mailing list archive
-
Message #00063
[Branch ~uws/anewt/anewt.uws] Rev 1684: [page] Throw errors instead of using assertions
------------------------------------------------------------
revno: 1684
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Sun 2009-07-19 21:41:12 +0200
message:
[page] Throw errors instead of using assertions
modified:
page/page.lib.php
=== modified file 'page/page.lib.php'
--- page/page.lib.php 2009-04-12 21:52:36 +0000
+++ page/page.lib.php 2009-07-19 19:41:12 +0000
@@ -269,7 +269,10 @@
/* This is a block-based page */
$default_block_name = $this->_get('default-block');
- assert('!is_null($default_block_name); // cannot use append() on block-based pages without a default block');
+
+ if (is_null($default_block_name))
+ throw new AnewtException('AnewtPage::append() can only be used on block-based pages if a default block is set.');
+
$this->append_to($default_block_name, $new_child);
} else
@@ -475,8 +478,8 @@
{
/* This is a page using div blocks */
- assert('!$this->_content || !$this->_content->has_child_nodes(); // pages using blocks should not have content outside blocks');
-
+ if ($this->_content && $this->_content->has_child_nodes())
+ throw new AnewtException('Pages using blocks should not have content outside blocks.');
/* The buffer holding all content is either a wrapper div or an
* invisible fragment (both XML nodes, so the API is the same). */
@@ -500,10 +503,15 @@
$this->_body->append_child($buffer);
- } else {
+ }
+ else
+ {
/* This page has no blocks, so we use the nodes in _content instead
* (if any) */
- assert('!$this->_blocks; // pages not using blocks should not have content in blocks');
+
+ if ($this->_blocks)
+ throw new AnewtException('Pages not using blocks should not have content in blocks');
+
if ($this->_content)
$this->_body->append_child($this->_content);
}
--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws
Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.