Commit 50265da7 authored by Ivan Tyagov's avatar Ivan Tyagov

Minor changes using portal_sessions tool.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12625 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8fbe37e1
...@@ -1510,7 +1510,7 @@ ...@@ -1510,7 +1510,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Commerce for ERP5 - using temp</string> </value> <value> <string>Commerce for ERP5</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
from Products.ERP5Type.Document import newTempOrderLine\n from Products.ERP5Type.Document import newTempOrderLine\n
quantity = int(context.REQUEST.get(\'field_my_buy_quantity\', 1))\n quantity = int(context.REQUEST.get(\'field_your_buy_quantity\', 1))\n
shopping_cart = context.SaleOrder_getShoppingCart()\n shopping_cart = context.SaleOrder_getShoppingCart()\n
shopping_cart_items = context.SaleOrder_getShoppingCartItemList()\n shopping_cart_items = context.SaleOrder_getShoppingCartItemList()\n
\n \n
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<string>my_title</string> <string>my_title</string>
<string>my_description</string> <string>my_description</string>
<string>my_price</string> <string>my_price</string>
<string>my_buy_quantity</string> <string>your_buy_quantity</string>
<string>submit</string> <string>submit</string>
</list> </list>
</value> </value>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_buy_quantity</string> </value> <value> <string>your_buy_quantity</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>""" Add resource to current (or to be created shopping cart). """\n <value> <string>""" Add resource to current (or to be created shopping cart). """\n
from DateTime import DateTime\n
\n \n
request = context.REQUEST\n request = context.REQUEST\n
expire_timeout_days = 90\n expire_timeout_days = 90\n
...@@ -77,7 +78,6 @@ portal_sessions = context.portal_sessions\n ...@@ -77,7 +78,6 @@ portal_sessions = context.portal_sessions\n
\n \n
if session_id is None:\n if session_id is None:\n
## first call so generate session_id and send back via cookie\n ## first call so generate session_id and send back via cookie\n
from DateTime import DateTime\n
now = DateTime()\n now = DateTime()\n
session_id = context.Base_generateSessionID(max_long=20)\n session_id = context.Base_generateSessionID(max_long=20)\n
request.RESPONSE.setCookie(\'session_id\', session_id, expires=(now +expire_timeout_days).fCommon(), path=\'/\')\n request.RESPONSE.setCookie(\'session_id\', session_id, expires=(now +expire_timeout_days).fCommon(), path=\'/\')\n
...@@ -92,16 +92,13 @@ else:\n ...@@ -92,16 +92,13 @@ else:\n
## take shopping cart for this customer\n ## take shopping cart for this customer\n
shopping_cart_id = \'shopping_cart\'\n shopping_cart_id = \'shopping_cart\'\n
session = portal_sessions[session_id]\n session = portal_sessions[session_id]\n
temp_container = portal_sessions #context.getPortalObject().temp_shopping_cart\n
if not shopping_cart_id in session.keys():\n if not shopping_cart_id in session.keys():\n
from Products.ERP5Type.Document import newTempOrder\n from Products.ERP5Type.Document import newTempOrder\n
shopping_cart = newTempOrder(temp_container, shopping_cart_id)\n shopping_cart = newTempOrder(portal_sessions, shopping_cart_id)\n
shopping_cart = portal_sessions.removeAq(shopping_cart)\n
session[shopping_cart_id] = shopping_cart\n session[shopping_cart_id] = shopping_cart\n
\n \n
## return just a part of session for shopping cart\n ## return just a part of session for shopping cart\n
shopping_cart = session[shopping_cart_id]\n shopping_cart = session[shopping_cart_id]\n
shopping_cart = portal_sessions.addAq(session[shopping_cart_id], temp_container)\n
return shopping_cart\n return shopping_cart\n
</string> </value> </string> </value>
</item> </item>
...@@ -155,6 +152,7 @@ else:\n ...@@ -155,6 +152,7 @@ else:\n
<tuple> <tuple>
<string>action</string> <string>action</string>
<string>new_shopping_cart</string> <string>new_shopping_cart</string>
<string>DateTime</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
...@@ -162,12 +160,10 @@ else:\n ...@@ -162,12 +160,10 @@ else:\n
<string>None</string> <string>None</string>
<string>session_id</string> <string>session_id</string>
<string>portal_sessions</string> <string>portal_sessions</string>
<string>DateTime</string>
<string>now</string> <string>now</string>
<string>shopping_cart_id</string> <string>shopping_cart_id</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>session</string> <string>session</string>
<string>temp_container</string>
<string>Products.ERP5Type.Document</string> <string>Products.ERP5Type.Document</string>
<string>newTempOrder</string> <string>newTempOrder</string>
<string>shopping_cart</string> <string>shopping_cart</string>
......
39 42
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment