Skip to content

Instantly share code, notes, and snippets.

class TestResource(Resource):
isLeaf = True
def __init__(self, response, code=http.OK, send_id=None):
self.response = response
self.code = code
self.send_id = send_id
def render_POST(self, request):
@jkage
jkage / gist:6366394
Last active December 21, 2015 21:09
call_user_func_array returning unexpected results for regex
public function validateResponses($check)
{
$count = 0;
foreach ($check['responses'] as $response) {
$validationErrors = array();
foreach ($this->validateResponse as $field => $rules) {
foreach ($rules as $rule) {
if (is_array($rule['rule'])) {
$func = $rule['rule'][0];
$args = array_slice($rule['rule'], 1);
@jkage
jkage / gist:5037251
Created February 26, 2013 09:28
test for 'prioritized' in dialogue model beforeValidate()
# Dialogue Model
function getRequiredFields($objectType=null)
{
return array(
'name',
'dialogue-id',
'auto-enrollment',
'interactions',
'activated',
@inlineCallbacks
def test_limit_max_unmatching_answers(self):
dialogue = self.collections['dialogues'].save(self.mkobj_dialogue_question())
self.collections['participants'].save(self.mkobj_participant('06'))
inbound_msg_unmatching = self.mkmsg_in(from_addr='06',
content='feel weird')
participant = self.collections['participants'].find_one({'phone': '06'})
for num in range(5):
yield self.send(inbound_msg_unmatching, 'inbound')
public function index()
{
$this->set('filterFieldOptions',$this->filterFieldOptions);
$this->set('filterTypeConditionsOptions',$this->filterTypeConditionsOptions);
$this->set('filterStatusConditionsOptions',$this->filterStatusConditionsOptions);
$this->set('programTimezone', $this->Session->read($this->params['program'].'_timezone'));
if ($this->params['ext'] == 'csv' or $this->params['ext'] == 'json') {
$statuses = $this->History->find('all', array('conditions' => $this->_getConditions(),
'order'=> array('timestamp' => 'DESC')