Author: matevz
Date: Fri Mar 8 13:08:58 2013
New Revision: 1454366
URL: http://svn.apache.org/r1454366
Log:
#429 - Multiproduct UI: Ticket page (ticket creation not working in full dialog)
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_ticket.html
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/ticket/web_ui.py?rev=1454366&r1=1454365&r2=1454366&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
Fri Mar 8 13:08:58 2013
@@ -47,7 +47,6 @@ class ProductTicketModule(TicketModule):
"""Override for TicketModule process_request"""
ticketid = req.args.get('id')
productid = req.args.get('productid','')
- ticket = Ticket(self.env, ticketid)
if ticketid:
if (req.path_info == '/products/' + productid + '/newticket' or
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py?rev=1454366&r1=1454365&r2=1454366&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
Fri Mar 8 13:08:58 2013
@@ -79,6 +79,24 @@ class ProductModule(Component):
pathinfo = '/'.join(pathinfo[:1] + pathinfo[3:])
environ['PATH_INFO'] = pathinfo
newreq = Request(environ, lambda *args, **kwds: None)
+ # Request.args[] are lazily evaluated, so special care
must be
+ # taken when creating new Requests from an old
environment, as
+ # the args will be evaluated again. In case of POST
requests,
+ # this comes down to re-evaluating POST parameters such as
+ # <form> arguments, which in turn causes yet another
read() on
+ # a socket, causing the request to block (deadlock).
+ #
+ # The following happens during Requests.args[] evaluation:
+ # 1. Requests.callbacks['args'] is called ->
arg_list_to_args(req.arg_list)
+ # 2. req.arg_list is evaluated, calling
Request._parse_arg_list
+ # 3. _parse_arg_list() calls _FieldStorage() for reading
the params
+ # 4. _FieldStorage() constructor calls
self.read_urlencoded()
+ # 5. this calls self.fp.read() which reads from the
socket
+ #
+ # Since the 'newreq' above is created from the same
environ as 'req',
+ # the newreq.args below caused a re-evaluation, thus a
deadlock.
+ # The fix is to copy the args from the old request to the
new one.
+ setattr(newreq, 'args', req.args)
new_handler = None
for hndlr in dispatcher.handlers:
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_ticket.html
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_ticket.html?rev=1454366&r1=1454365&r2=1454366&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_ticket.html
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_ticket.html
Fri Mar 8 13:08:58 2013
@@ -66,21 +66,36 @@
// Install in place editing
var modify_elem = $('#modify');
- <py:if test="ticket.exists">
- modify_elem.parent().hide();
- $('#propertyform .buttons [name="preview"]').hide();
- $('#comment').change(function (e) {
- $('#hidden-comment').val($('#comment').val());
- });
- $('#propertyform .buttons [name="submit"]').click(function (e) {
- if ($('button#edit-submit').length) {
- // if available trigger the edit state's update button
- $('button#edit-submit').click();
- e.preventDefault();
- }
- // otherwise the default submit comment only happens
- });
- </py:if>
+ <py:choose test="ticket.exists">
+ <py:when test="True">
+ modify_elem.parent().hide();
+ $('#propertyform .buttons [name="preview"]').hide();
+ $('#comment').change(function (e) {
+ $('#hidden-comment').val($('#comment').val());
+ });
+ $('#propertyform .buttons [name="submit"]').click(function (e) {
+ if ($('button#edit-submit').length) {
+ // if available trigger the edit state's update button
+ $('button#edit-submit').click();
+ e.preventDefault();
+ }
+ // otherwise the default submit comment only happens
+ });
+ </py:when>
+ <py:otherwise>
+ $('#propertyform .buttons [name="submit"]').click(function(e) {
+ /*
+ change the form action from /products to
+ /products/target_product/newticket#ticket
+ */
+ var form = $('#propertyform');
+ var action = form.attr('action') + '/' +
+ $('#propertyform [name="field_product"]').val() +
+ '/newticket#ticket';
+ form.attr('action', action);
+ });
+ </py:otherwise>
+ </py:choose>
function modify_ticket() {
if ($('#vc-summary').is('.edit-active'))
@@ -379,7 +394,7 @@
<!--! add comment + modify ticket -->
<form py:if="has_property_editor" method="post" id="propertyform"
action="${href.ticket(ticket.id) + '#trac-add-comment' if
ticket.exists
- else href.newticket() + '#ticket'}">
+ else href.products()}">
<div py:if="ticket.exists and can_append">
<!--! Add comment -->
<div id="trac-add-comment" class="field">