Commits

Bruce Kroeze committed f89f70c

merging from upstream

Comments (0)

Files changed (2)

satchmo/apps/shipping/config.py

     choices=[('shipping.modules.per', _('Per piece'))],
     ordering=0
     ))
-    
+
 config_register(
     StringValue(SHIPPING_GROUP,
         'HIDING',
             ('YES', _('Yes')),
             ('DESCRIPTION', _('Show description only'))
         )))
-        
+
+config_register(
+    BooleanValue(SHIPPING_GROUP,
+        'DOWNLOAD_PDFS',
+        description = _("Download PDFs from admin page"),
+        default=True,
+        ordering=5
+        ))
+
 config_register(
     BooleanValue(SHIPPING_GROUP,
         'SELECT_CHEAPEST',
 
 
 # --- Load default shipping modules.  Ignore import errors, user may have deleted them. ---
-# DO NOT ADD 'tiered' or 'no' to this list.  
+# DO NOT ADD 'tiered' or 'no' to this list.
 # 'no' is used internally
 # 'Tiered' is special, since it needs to be added as a module.  To enable it,
 # just add shipping.modules.tiered to your INSTALLED_APPS
         module = load_module(m)
         methods.extend(module.get_methods())
     return methods
-    
+
 def shipping_method_by_key(key):
     if key and key != "NoShipping":
         for method in shipping_methods():
     else:
         import shipping.modules.no.shipper as noship
         method = noship.Shipper()
-        
+
     if method:
         return method
     else:
         raise ShippingModuleNotFound(key)
-        
+
 
 def shipping_choices():
     choices = []

satchmo/apps/shipping/views.py

     else:
         return HttpResponseRedirect('/admin')
     response = HttpResponse(mimetype='application/pdf')
-    response['Content-Disposition'] = 'attachment; filename=%s' % filename
+    if config_value('SHIPPING','DOWNLOAD_PDFS'):
+        response['Content-Disposition'] = 'attachment; filename=%s' % filename
     icon_uri = config_value('SHOP', 'LOGO_URI')
     t = loader.get_template(os.path.join('shop/pdf', template))
     c = Context({