コード例 #1
0
ファイル: product.py プロジェクト: hforge/shop
 def get_price_prefix(self):
     shop = get_shop(self)
     context = get_context()
     group_name = get_group_name(shop, context)
     if get_uri_name(group_name) == 'pro':
         return 'pro-'
     return ''
コード例 #2
0
 def get_price_prefix(self):
     shop = get_shop(self)
     context = get_context()
     group_name = get_group_name(shop, context)
     if get_uri_name(group_name) == 'pro':
         return 'pro-'
     return ''
コード例 #3
0
ファイル: build_gulp.py プロジェクト: Ramel/itools
 def launch_gulp_build(self):
     done = False
     for path in self.manifest:
         filename = get_uri_name(path)
         if filename == 'package.json':
             print '***' * 25
             print '*** Run $ gulp build on ', path
             print '***' * 25
             path = str(Path(path)[:-1]) + '/'
             p = Popen(['gulp', 'build'], cwd=path)
             p.wait()
             if p.returncode == 1:
                 print '***' * 25
                 print '*** Error running gulp ', path
                 print '***' * 25
                 sys.exit(1)
             done = True
     return done
コード例 #4
0
ファイル: build_gulp.py プロジェクト: Ramel/itools
 def launch_npm_install(self):
     done = False
     for path in self.manifest:
         filename = get_uri_name(path)
         if filename == 'package.json':
             print '***' * 25
             print '*** Run $ npm install on ', path
             print '***' * 25
             path = str(Path(path)[:-1]) + '/'
             p = Popen(['npm', 'install'], cwd=path)
             p.wait()
             if p.returncode == 1:
                 print '***' * 25
                 print '*** Error running npm install ', path
                 print '***' * 25
                 sys.exit(1)
             done = True
     return done
コード例 #5
0
ファイル: build_gulp.py プロジェクト: nkhine/itools
 def launch_webpack(self):
     done = False
     for path in self.manifest:
         filename = get_uri_name(path)
         if filename == 'webpack.config.js':
             print '***'*25
             print '*** Run $ webpack ', path
             print '***'*25
             path = str(Path(path)[:-1]) + '/'
             p = Popen(['./node_modules/.bin/webpack', '--mode=production'], cwd=path)
             p.wait()
             if p.returncode == 1:
                 print '***'*25
                 print '*** Error running webpack ', path
                 print '***'*25
                 sys.exit(1)
             done = True
     return done
コード例 #6
0
ファイル: build_gulp.py プロジェクト: hforge/itools
 def launch_gulp_build(self):
     done = False
     for path in self.manifest:
         filename = get_uri_name(path)
         if filename == 'gulpfile.js' and path.startswith('ui_dev/'):
             print '***'*25
             print '*** Run $ gulp build on ', path
             print '***'*25
             path = str(Path(path)[:-1]) + '/'
             p = Popen(['gulp', 'build'], cwd=path)
             p.wait()
             if p.returncode == 1:
                 print '***'*25
                 print '*** Error running gulp ', path
                 print '***'*25
                 sys.exit(1)
             done = True
     return done
コード例 #7
0
ファイル: build_gulp.py プロジェクト: hforge/itools
 def launch_npm_install(self):
     done = False
     for path in self.manifest:
         filename = get_uri_name(path)
         if filename == 'package.json' and path.startswith('ui_dev/'):
             print '***'*25
             print '*** Run $ npm install on ', path
             print '***'*25
             path = str(Path(path)[:-1]) + '/'
             p = Popen(['npm', 'install'], cwd=path)
             p.wait()
             if p.returncode == 1:
                 print '***'*25
                 print '*** Error running npm install ', path
                 print '***'*25
                 sys.exit(1)
             done = True
     return done
コード例 #8
0
 def get_javascript_namespace(self, declinations):
     # XXX
     # We have to Add price without tax (Before and after reduction)
     # XXX If handle_stock property is false manage_stock should be false
     manage_stock = self.get_stock_option() != 'accept'
     purchase_options_names = self.get_purchase_options_names()
     # Base product
     stock_quantity = self.get_property('stock-quantity')
     products = {}
     if len(declinations) == 0:
         products['base_product'] = {
             'price_ht': format_price(self.get_price_without_tax()),
             'price_ttc': format_price(self.get_price_with_tax()),
             'weight': str(self.get_weight()),
             'image': [],
             'option': {},
             'is_default': True,
             'stock': stock_quantity if manage_stock else None
         }
     # Other products (declinations)
     for declination in declinations:
         dynamic_schema = declination.get_dynamic_schema()
         stock_quantity = declination.get_quantity_in_stock()
         price_ht = self.get_price_without_tax(
             id_declination=declination.name)
         price_ttc = self.get_price_with_tax(
             id_declination=declination.name)
         image = None  #declination.get_property('associated-image')
         products[declination.name] = {
             'price_ht': format_price(price_ht),
             'price_ttc': format_price(price_ttc),
             'weight': str(declination.get_weight()),
             'image': get_uri_name(image) if image else None,
             'is_default': declination.get_property('is_default'),
             'option': {},
             'stock': stock_quantity if manage_stock else None
         }
         for name in purchase_options_names:
             value = declination.get_dynamic_property(name, dynamic_schema)
             if value:
                 products[declination.name]['option'][name] = value
     return dumps(products)
コード例 #9
0
ファイル: product.py プロジェクト: hforge/shop
 def get_javascript_namespace(self, declinations):
     # XXX
     # We have to Add price without tax (Before and after reduction)
     # XXX If handle_stock property is false manage_stock should be false
     manage_stock = self.get_stock_option() != 'accept'
     purchase_options_names = self.get_purchase_options_names()
     # Base product
     stock_quantity = self.get_property('stock-quantity')
     products = {}
     if len(declinations)==0:
         products['base_product'] = {
             'price_ht': format_price(self.get_price_without_tax()),
             'price_ttc': format_price(self.get_price_with_tax()),
             'weight': str(self.get_weight()),
             'image': [],
             'option': {},
             'is_default': True,
             'stock': stock_quantity if manage_stock else None}
     # Other products (declinations)
     for declination in declinations:
         dynamic_schema = declination.get_dynamic_schema()
         stock_quantity = declination.get_quantity_in_stock()
         price_ht = self.get_price_without_tax(id_declination=declination.name)
         price_ttc = self.get_price_with_tax(id_declination=declination.name)
         image = None#declination.get_property('associated-image')
         products[declination.name] = {
           'price_ht': format_price(price_ht),
           'price_ttc': format_price(price_ttc),
           'weight': str(declination.get_weight()),
           'image': get_uri_name(image) if image else None,
           'is_default': declination.get_property('is_default'),
           'option': {},
           'stock': stock_quantity if manage_stock else None}
         for name in purchase_options_names:
             value = declination.get_dynamic_property(name, dynamic_schema)
             if value:
                 products[declination.name]['option'][name] = value
     return dumps(products)
コード例 #10
0
ファイル: taxes.py プロジェクト: hforge/shop
 def get_namespace(self, datatype, value):
     context = get_context()
     namespace = {'groups': []}
     is_product = context.resource.class_id == 'product'
     if is_product:
         not_buyable_by_groups = context.resource.get_property('not_buyable_by_groups')
     else:
         not_buyable_by_groups = []
     for group in UserGroup_Enumerate.get_options():
         prefix = ''
         group['id'] = get_uri_name(group['name'])
         if group['id'] != 'default':
             prefix = '%s-' % group['id']
         group['not_buyable'] = group['name'] in not_buyable_by_groups
         widget_name = '%spre-tax-price' % prefix
         if is_product:
             value = context.resource.get_property(widget_name)
         else:
             value = None
         group['widget'] = PriceWidget(widget_name,
                             prefix=prefix).to_html(None, value)
         namespace['groups'].append(group)
     return namespace
コード例 #11
0
ファイル: taxes.py プロジェクト: nicolasderam/shop
 def get_namespace(self, datatype, value):
     context = get_context()
     namespace = {'groups': []}
     is_product = context.resource.class_id == 'product'
     if is_product:
         not_buyable_by_groups = context.resource.get_property(
             'not_buyable_by_groups')
     else:
         not_buyable_by_groups = []
     for group in UserGroup_Enumerate.get_options():
         prefix = ''
         group['id'] = get_uri_name(group['name'])
         if group['id'] != 'default':
             prefix = '%s-' % group['id']
         group['not_buyable'] = group['name'] in not_buyable_by_groups
         widget_name = '%spre-tax-price' % prefix
         if is_product:
             value = context.resource.get_property(widget_name)
         else:
             value = None
         group['widget'] = PriceWidget(widget_name,
                                       prefix=prefix).to_html(None, value)
         namespace['groups'].append(group)
     return namespace
コード例 #12
0
 def get_basename(reference):
     return get_uri_name(reference)
コード例 #13
0
ファイル: vfs.py プロジェクト: Nabellaleen/itools
 def get_basename(reference):
     return get_uri_name(reference)