Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)

            def wrapper(*args, **kwargs):
        logger = logging.getLogger('karesansui.db.access')
        session = args[0]
        model = args[1]
        model_name = get_model_name(model)
        model_id = model.id  # If you do not flush the session, Unable to retrieve the model id.
        try:
            func(*args, **kwargs)
        except UnmappedInstanceError, ui:
            logger.error(('Data to insert is failed, '
                          'Invalid value was inputed. '
                          '- %s=%s, error=%s') % (model_name, model_id, ''.join(ui)))
            raise KaresansuiDBException(('Data to insert is failed, '
                          'Invalid value was inputed. '
                          '- %s=%s, error=%s') % (model_name, model_id, ''.join(ui)))

        num = len(session.new)
        if not num:
            logger.warn('Data has not been changed. - %s=%s' %  (model_name, model_id))
            return num  # The return value assume zero
        
        logger.debug('Data to insert is succeeded. - %s=%s' % (model_name, model_id))
        return num
        


src/k/a/karesansui-HEAD/karesansui/gadget/guestby1snapshotby1.py   karesansui(Download)
 
from karesansui.db.access.machine  import findbyguest1 as m_findbyguest1
from karesansui.db.access.snapshot import findby1 as s_findby1, \
     findbyname_guestby1 as s_findbyname_guestby1, \
     logical_delete, save as save_snapshot
            notebook = new_notebook(self.input.title, self.input.value)
            snapshot = new_snapshot(guest, int(snapshot_id), self.me, self.me, notebook)
            save_snapshot(self.orm, snapshot)
        else:
            snapshot.notebook.title = self.input.title

src/k/a/karesansui-HEAD/karesansui/gadget/guestby1snapshot.py   karesansui(Download)
from karesansui.db.access.machine import findbyguest1
from karesansui.db.access.notebook import new as new_notebook
from karesansui.db.access.snapshot import new as new_snapshot, \
     save as save_snapshot, \
     findbyname_guestby1 as s_findbyname_guestby1
        notebook = new_notebook(self.input.title, self.input.value)
        snapshot = new_snapshot(guest, id, self.me, self.me, notebook)
        save_snapshot(self.orm, snapshot)
 
        options = {}