Esempio n. 1
0
 def has_errors(self, field_name, *errors, **kw):
     have_error = False
     field_name = tup(field_name)
     for error_name in errors:
         for fname in field_name:
             if (error_name, fname) in c.errors:
                 self.set_error(error_name, fname)
                 have_error = True
     return have_error
Esempio n. 2
0
            def wrap_processor(msgs, *args):
                # Work the same for amqp.consume_items and amqp.handle_items.
                msg_tup = utils.tup(msgs)

                start = time.time()
                try:
                    return processor(msgs, *args)
                finally:
                    service_time = (time.time() - start) / len(msg_tup)
                    for msg in msg_tup:
                        self.transact('amqp.%s' % queue_name, service_time)
Esempio n. 3
0
    def _things(self, things, action, *a, **kw):
        """
        function for inserting/replacing things in listings.
        """
        things = tup(things)
        if not all(isinstance(t, Wrapped) for t in things):
            wrap = kw.pop('wrap', Wrapped)
            things = wrap_links(things, wrapper = wrap)
        data = [self.process_rendered(t.render()) for t in things]

        if kw:
            for d in data:
                if d.has_key('data'):
                    d['data'].update(kw)

        self._data['things'] = data
        return data
Esempio n. 4
0
 def insert_table_rows(self, rows, index = -1):
     new = self.__getattr__("insert_table_rows")
     return new([row.render() for row in tup(rows)], index)