def run(self): print('Process 2 start') # sleep(2) import wdb; wdb.set_trace() sleep(1) print('Process 2 end')
def _create(self, data): import wdb wdb.set_trace() binding = super(SaleOrderImporter, self)._create(data) if binding.fiscal_position_id: binding.odoo_id._compute_tax_id() return binding
def _compute_image_url(self): import wdb wdb.set_trace() import base64 import requests return base64.b64encode(requests.get(self.url_image).content)
def wtf_error(): import wdb wdb.set_trace() a = 2 a / 0 return 12
def run(self): print('Process 2 start') # sleep(2) import wdb wdb.set_trace() sleep(1) print('Process 2 end')
async def self_shell() -> None: # pragma: no cover """ Function for run self shell(debug) """ # pylint: disable=import-outside-toplevel import wdb # isort:skip wdb.set_trace() # pylint: disable=no-member
def wtf(): a = 12 b = 21 c = a / b import wdb wdb.set_trace() d = a - 2 e = b + a - c + d return 'OK! %d' % e
def finalize(self, map_record, values): import wdb wdb.set_trace() values.setdefault('order_line', []) # values = self._add_shipping_line(map_record, values) values.update({ 'partner_id': self.partner_id, 'partner_invoice_id': self.partner_id, 'partner_shipping_id': self.partner_id, })
def create_new_tag_back(self): self.ensure_one() tag = self.env['helpdesk.tag'].create({ 'name': self.new_tag_name # 'tag_ids': [(4, self.id, 0)] }) # self.write({ # 'tag_ids': [(4, tag.id, 0)] # }) import wdb wdb.set_trace() self.tag_ids = self.tag_ids + tag
def _transport_backup(self, dump_db, filename=None): ICPSudo = self.env['ir.config_parameter'].sudo() server = ICPSudo.get_param('saas_server.sftp_server', None) username = ICPSudo.get_param('saas_server.sftp_username', None) password = ICPSudo.get_param('saas_server.sftp_password', None) path = ICPSudo.get_param('saas_server.sftp_path', None) rsa_key_path = ICPSudo.get_param('saas_server.rsa_key_path', None) rsa_key_passphrase=ICPSudo.get_param('saas_server.rsa_key_passphrase') sftp_public_key=ICPSudo.get_param('saas_server.sftp_public_key') params = { "host": server, "username": username, } if rsa_key_path: params["private_key"] = self.rsa_key_path if rsa_key_passphrase: params["private_key_pass"] = rsa_key_passphrase else: params["password"] = password cnopts = pysftp.CnOpts() if sftp_public_key: key = paramiko.RSAKey(data=base64.b64decode(sftp_public_key)) cnopts.hostkeys.add(server, 'ssh-rsa', key) else: cnopts.hostkeys = None with pysftp.Connection(**params, cnopts=cnopts) as sftp: # set keepalive to prevent socket closed / connection dropped error sftp._transport.set_keepalive(30) import wdb; wdb.set_trace() try: sftp.chdir(path) except IOError: # Create directory and subdirs if they do not exist. currentDir = '' for dirElement in path.split('/'): currentDir += dirElement + '/' try: sftp.chdir(currentDir) except Exception as e: print(('(Part of the) path doesn\'t exist. Creating it now at ' + currentDir)) # Make directory and then navigate into it sftp.mkdir(currentDir, mode=777) sftp.chdir(currentDir) with tempfile.TemporaryFile() as t: dump_db(t) t.seek(0) sftp.putfo(t, filename)
def wtf(): a = 12 b = 21 c = a / b import wdb wdb.set_trace() d = a - 2 e = b + a - c + d for i in range(5): e += i # Test breaking on /usr/lib/python2.7/logging/__init__.py:1254 app.logger.info('I was here') return 'OK! %d' % e
def read_from_bottom_(n, filename): def index_of_next_line(string): return string.find("\n") with open(filename, "r") as f: file_as_string = f.read() wdb.set_trace() runnerIndex = index_of_next_line(file_as_string) + 1 for i in range(n-1): print file_as_string[runnerIndex:] runnerIndex = runnerIndex + index_of_next_line(file_as_string[runnerIndex:])
def create_room(self, shortcode, name, capacity, price, availability, defboard, rtype): import wdb wdb.set_trace() rcode, results = self._server.new_room(self._session_info[0], self._session_info[1], 0, name, capacity, price, availability, shortcode[:4], defboard, rtype) if rcode != 0: raise ChannelConnectorError(_("Can't create room in WuBook"), { 'message': results, }) return results
def update(self, _id, **params): """ Validate quotation """ try: import wdb wdb.set_trace() # chequear consistencia de parametros self._check_parameters(params) # eliminar productos que no se han elegido quotation = self.env['sale.order'].search([('id', '=', _id)]) product_id = params['product_id'] participants = params['participants'] if not quotation: msg = 'The quotation being validated (id=%d) does not exist.' raise ValidationError(_(msg) % _id) # verificar que el producto elegido exista en la cotizacion prod = quotation.order_line.filtered( lambda x: x.product_id.id == product_id) if not prod: msg = 'The product (id=%d) does not exist in the quotation ' msg += '(id=%d) being validated.' raise ValidationError(_(msg) % (product_id, _id)) # eliminar los que no eligieron for sol in quotation.order_line: if sol.product_id.id != product_id: sol.unlink() # agregar los usuarios como seguidores self._set_users_to_notify(quotation) # validar el presupuesto quotation.action_confirm() # agregar los participantes for participant in participants: participant['sale_order_id'] = _id quotation.participant_ids.create(participant) return {'code': 200, 'description': 'OK'} except ValidationError as ex: # manejar las excepciones en validacion de datos. return self._validation_error(ex.name)
def f(): # Enable wdb wdb = Wdb.get() Wdb.enabled = True start_response('200 OK', [('Content-Type', 'text/html'), ('X-Thing', wdb.uuid)]) yield to_bytes(' ' * 4096) wdb = set_trace() wdb.die() yield to_bytes('Exited')
def f(): # Enable wdb wdb = Wdb.get() Wdb.enabled = True start_response('200 OK', [ ('Content-Type', 'text/html'), ('X-Thing', wdb.uuid)]) yield to_bytes(' ' * 4096) wdb = set_trace() wdb.die() yield to_bytes('Exited')
def Execute(self, config, context): try: log.LogInfo("Running TEST.Execute") import wdb wdb.set_trace() print "trace" x() x() x() print "endtrace" #cl = RepoServiceClient(context.Site) # TODO sometime - config validation before updating, report errors and keep the working old config #cl.Reload(context.ListItem) return "TEST" except Exception, exc: log.LogError("TEST plugin failed with exception", exc)
def _import_sale_orders(self, import_start_time=None, import_end_time=None, update_import_date=True): import wdb wdb.set_trace() for backend in self: user = backend.warehouse_id.company_id.user_tech_id if not user: user = self.env['res.users'].browse(self.env.uid) if not backend.import_updated_sales_from_date: backend.import_updated_sales_from_date = backend.import_sales_from_date if not import_end_time: import_end_time = datetime.strptime( datetime.today().strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S') - timedelta(minutes=2) # If the start date to get sales is empty we put now as date if not import_start_time: if backend.import_sales_from_date: import_start_time = datetime.strptime( backend.import_sales_from_date, '%Y-%m-%d %H:%M:%S') else: import_start_time = import_end_time sale_binding_model = self.env['ebay.sale.order'] if user != self.env.user: sale_binding_model = sale_binding_model.sudo(user) filters = { 'CreateTimeFrom': import_start_time.isoformat(), 'CreateTimeTo': import_end_time.isoformat() } sale_binding_model.import_batch(backend, filters=filters) if update_import_date: backend.write({'import_sales_from_date': import_end_time}) return True
def create_child_exec(self): service = self.service_id self = self.with_context(autocreate=True) self.delete_child_exec() import wdb wdb.set_trace() self.env['clouder.service'].create({ 'environment_id': service.environment_id.id, 'suffix': service.suffix + '-' + self.name.code, 'parent_id': self.id, 'application_id': self.name.id, 'node_id': self.node_id.id or service.node_id.id }) if self.backup_id: self.backup_id.service_id = self.child_id self.backup_id.restore()
def product_uom_change(self): super(SaleOrderLine, self).product_uom_change() if not self.product_uom: self.price_unit = 0.0 return if self.order_id.pricelist_id and self.order_id.partner_id: product = self.product_id.with_context( lang=self.order_id.partner_id.lang, partner=self.order_id.partner_id.id, quantity=self.product_uom_qty, date_order=self.order_id.date_order, pricelist=self.order_id.pricelist_id.id, uom=self.product_uom.id, fiscal_position=self.env.context.get('fiscal_position'), width=self.origin_width, height=self.origin_height) #esto sobra por completo si tienes un buen IDE import wdb wdb.set_trace() self.price_unit = self.env['account.tax']._fix_tax_included_price( product.price, product.taxes_id, self.tax_id)
def __call__(self, environ, start_response): path = environ.get('PATH_INFO', '') if path == '/__wdb/on': # Enable wdb Wdb.enabled = True start_response('200 OK', [('Content-Type', 'text/html')]) return to_bytes('Wdb is now on'), if path == '/__wdb/shell': # Enable wdb Wdb.enabled = True wdb = set_trace() start_response('200 OK', [('Content-Type', 'text/html')]) wdb.die() return to_bytes('Exited'), if Wdb.enabled: def trace_wsgi(environ, start_response): appiter = None try: with trace(close_on_exit=True): appiter = self.app(environ, start_response) for item in appiter: yield item except Exception: start_response('500 INTERNAL SERVER ERROR', [('Content-Type', 'text/html')]) yield _handle_off() finally: hasattr(appiter, 'close') and appiter.close() return trace_wsgi(environ, start_response) def catch(environ, start_response): appiter = None try: appiter = self.app(environ, start_response) for item in appiter: yield item except Exception: start_response('500 INTERNAL SERVER ERROR', [('Content-Type', 'text/html')]) yield _handle_off() finally: # Close set_trace debuggers stop_trace(close_on_exit=True) hasattr(appiter, 'close') and appiter.close() return catch(environ, start_response)
def __call__(self, environ, start_response): path = environ.get('PATH_INFO', '') if path == '/__wdb/on': # Enable wdb Wdb.enabled = True start_response('200 OK', [('Content-Type', 'text/html')]) return to_bytes('Wdb is now on'), if path == '/__wdb/shell': # Enable wdb Wdb.enabled = True wdb = set_trace() start_response('200 OK', [('Content-Type', 'text/html')]) wdb.die() return to_bytes('Exited'), if Wdb.enabled: def trace_wsgi(environ, start_response): appiter = None try: with trace(close_on_exit=True): appiter = self.app(environ, start_response) for item in appiter: yield item except Exception: start_response('500 INTERNAL SERVER ERROR', [ ('Content-Type', 'text/html')]) yield _handle_off() finally: hasattr(appiter, 'close') and appiter.close() return trace_wsgi(environ, start_response) def catch(environ, start_response): appiter = None try: appiter = self.app(environ, start_response) for item in appiter: yield item except Exception: start_response('500 INTERNAL SERVER ERROR', [ ('Content-Type', 'text/html')]) yield _handle_off() finally: # Close set_trace debuggers stop_trace(close_on_exit=True) hasattr(appiter, 'close') and appiter.close() return catch(environ, start_response)
def _handler(event, context): request_id = '(unknown)' try: if 'wdb' in available_extras: available_extras['wdb']['start_trace']() # Will be True if CELERY_SERVERLESS_BREAKPOINT is defined. # It is the preferred way to force a breakpoint. if available_extras['wdb']['breakpoint']: import wdb wdb.set_trace() # Tip: you may want to step into fn() near line 70 ;) ### 4th hook call _maybe_call_hook(ENVVAR_NAMES['pre_handler_call'], locals()) try: request_id = context.aws_request_id except AttributeError: pass logger.info('START: Handle request ID: %s', request_id) return fn(event, context) except Exception as e: if 'sentry' in available_extras: logger.warning('Sending exception collected to Sentry client') available_extras['sentry'].captureException() ### Err hook call _maybe_call_hook(ENVVAR_NAMES['error_handler_call'], locals()) raise finally: logger.info('END: Handle request ID: %s', request_id) ### 5th hook call _maybe_call_hook(ENVVAR_NAMES['post_handler_call'], locals()) if 'wdb' in available_extras: available_extras['wdb']['stop_trace']()
def index(): #https://docs.python.org/2/library/pdb.html wdb.set_trace() a+=1 return '<h1 style="background-color: orange">Hello World!</h1>'
def self_shell(variables): # Debugging self import wdb wdb.set_trace()
def fun2(l): import wdb wdb.set_trace() a = 2 e = fun1(a) return e
a = { 'a': 3, } b = {'b': 4, 'a': a} a['b'] = b import wdb wdb.set_trace()
def _compute_sku_products(self): import wdb wdb.set_trace() self.env['product.template'].search([()])
def import_batch(self, backend, filters=None): _super = super(AmazonReport, self) import wdb wdb.set_trace() return _super.import_batch(backend, filters=filters)
# -*- coding: latin-1 -*- import sys def u(s): """Python 3.2...""" if sys.version_info[0] == 2: return s.decode('latin-1') return s print(u('יאח')) import wdb wdb.set_trace()
def work(): wdb.set_trace() a = create_a(5) b = create_a(2) a, b, c = combine(a, b) display(a, b, wdb, c=c, cls=A, obj=object)
def tf(self): set_trace(sys._getframe().f_back)
def _get_default_checkin(self): import wdb wdb.set_trace() return self.folio_wizard_id.checkin
def self_shell(variables): import wdb wdb.set_trace()
def _save_data_product(self, supplier, list_prod, prefix): import wdb wdb.set_trace() for prod in list_prod: try: res_prod = self.env['product.template'].search([ ('default_code', '=', prefix + prod['default_code']) ]) prod_code = prod['default_code'] if res_prod and res_prod.id: price = res_prod._compute_price_without_taxes( float(prod.get('standard_price'))) if prod.get( 'tax_included') else prod.get('standard_price') w_prod = {'id': res_prod.id} w_prod['name'] = prod.get('name') w_prod['description'] = prod.get('description') w_prod['standard_price'] = price w_prod['barcode'] = prod.get('barcode') # res_prod['image'] = prod.get('image') result = self.env['product.template'].write(w_prod) if result: sup_prod = {'name': supplier.id} sup_prod['product_name'] = w_prod['name'] sup_prod['product_code'] = prod_code if prod.get('min_qty'): sup_prod['min_qty'] = prod['min_qty'] else: sup_prod['min_qty'] = 1 sup_prod['price'] = price sup_prod['product_id'] = res_prod.product_variant_id.id sup_prod['product_tmpl_id'] = res_prod.id self.env['product.supplierinfo'].write(sup_prod) else: prod['default_code'] = prefix + prod_code prod['type'] = 'product' if prod['urls_image']: prod['image'] = prod['urls_image'][0][1] result = self.env['product.template'].create(prod) if result: sup_prod = {'name': supplier.partner_id.id} sup_prod['product_name'] = prod['name'] sup_prod['product_code'] = prod_code sup_prod['price'] = result._compute_price_without_taxes(float(prod.get('standard_price'))) if prod.get('tax_included') \ else prod.get('standard_price') sup_prod['product_id'] = result.product_variant_id.id sup_prod['product_tmpl_id'] = result.id result = self.env['product.supplierinfo'].create( sup_prod) if prod.get('urls_image') and result: for url, image in prod['urls_image']: result.write({ 'product_image_ids': [(0, 0, { 'name': url, 'image': image, 'product_tmpl_id': result.id, })] }) except Exception, e: print str(e)
def run(self): print('Thread 2 start') sleep(2) import wdb; wdb.set_trace() print('Thread 2 end')
def turn_wdb(self): import wdb wdb.set_trace()
def post_test(): a = 2 import wdb wdb.set_trace() return 'POST RETURN %r' % request.values
def trigger_wdb(self, msg, matches): peer = self.bot.get_peer_to_send(msg) wdb.set_trace()
import os print 'Forking' pid = os.fork() if pid == 0: print 'In children' import wdb; wdb.set_trace() print 'Children dead' else: print 'In parent' import wdb; wdb.set_trace() print 'Parent dead' print 'The End'
def fun2(l): import wdb; wdb.set_trace() a = 2 e = fun1(a) return e
def post_test(): a = 2 import wdb wdb.set_trace() return "POST RETURN %r" % request.values
def run(self): print('Process 1 start') sleep(1) import wdb; wdb.set_trace() print('Process 1 end') sleep(1)