Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@kssaction
def saveFormatter(self, portlethash):
"""
"""
fi = IFormats(self.context)
fi.setFormats(self.request.form)
kss_core = self.getCommandSet("core")
kss_zope = self.getCommandSet("zope")
kss_plone = self.getCommandSet("plone")
layout = self.request.form.get("layout")
if layout == "categories-view":
kss_zope.refreshViewlet(kss_core.getHtmlIdSelector("categories-list"),
manager="easyshop.categories-manager",
name="easyshop.categories-viewlet")
@kssaction
def cancelAddress(self):
"""
"""
# Refresh addresses
kss_core = self.getCommandSet("core")
kss_zope = self.getCommandSet("zope")
selector = kss_core.getHtmlIdSelector("manage-address-book")
kss_zope.refreshViewlet(selector,
manager="easyshop.manager.addresses",
name="easyshop.addresses")
@kssaction
def funnelwebProgress(self):
return
sm = self.context.getSiteManager()
#service = sm.getUtility(lovely.remotetask.interfaces.ITaskService, name="FunnelwebService")
ksscore = self.getCommandSet('core')
selector = ksscore.getHtmlIdSelector('form-widgets-results')
session = self.context.REQUEST.SESSION
jobid = session.get('jobid')
if jobid:
#status = service.getStatus(jobid)
status = None
else:
status = None
feedback = session.get('funnelwebfeedback')
if feedback:
@kssaction
def addAddress(self, form):
"""
"""
shop = IShopManagement(self.context).getShop()
customer = ICustomerManagement(shop).getAuthenticatedCustomer()
id = self.context.generateUniqueId("Address")
customer.invokeFactory("Address", id=id, title=form.get("address1"))
address = getattr(customer, id)
# set data
address.setFirstname(form.get("firstname", ""))
address.setLastname(form.get("lastname", ""))
address.setLastname(form.get("companyName", ""))
address.setAddress1(form.get("address1", ""))
@kssaction
def showProducts(self, letter=None, form={}):
"""
"""
catalog = getToolByName(self.context, "portal_catalog")
kss_core = self.getCommandSet("core")
searchable_text = form.get("searchable_text", "")
products = []
if searchable_text != "":
products = catalog.searchResults(
path = "/".join(self.context.getPhysicalPath()),
object_provides = "easyshop.core.interfaces.catalog.IProduct",
SearchableText = searchable_text,
sort_on = "sortable_title",
)
@kssaction
def showAddAddressForm(self):
"""
"""
html = self._getAddAddressForm()
# refresh cart
kss_core = self.getCommandSet("core")
kss_core.replaceHTML('#add-address-form', html)
@kssaction
def showProductDetails(self, uid):
"""
"""
catalog = getToolByName(self.context, "portal_catalog")
brains = catalog.searchResults(
UID = uid
)
try:
product = brains[0].getObject()
except IndexError:
return
cm = ICurrencyManagement(self.context)
price = cm.priceToString(product.getPrice())
@kssaction
def saveFormatter(self, portlethash):
"""
"""
fi = IFormats(self.context)
fi.setFormats(self.request.form)
kss_core = self.getCommandSet("core")
kss_zope = self.getCommandSet("zope")
kss_plone = self.getCommandSet("plone")
layout = self.request.form.get("layout")
if layout == "categories-view":
kss_zope.refreshViewlet(kss_core.getHtmlIdSelector("categories-list"),
manager="easyshop.categories-manager",
name="easyshop.categories-viewlet")
@kssaction
def saveFormatter(self, form, portlethash):
"""
"""
fi = IFormats(self.context)
fi.setFormats(form)
kss_core = self.getCommandSet("core")
kss_zope = self.getCommandSet("zope")
kss_plone = self.getCommandSet("plone")
layout = form.get("layout")
if layout == "categories-view":
kss_zope.refreshViewlet(kss_core.getHtmlIdSelector("categories-list"),
manager="easyshop.categories-manager",
name="easyshop.categories-viewlet")
@kssaction
def showEditAddressForm(self, form):
"""
"""
catalog = getToolByName(self.context, "portal_catalog")
brains = catalog.searchResults(
UID = form.get("uid", "")
)
try:
address = brains[0].getObject()
except:
return
html = ""
html += self._getEditAddressForm(address)
html += ""