Skip to Content
Menu
This question has been flagged

I got a wizard it generates the svg image data , how to return as a response to the browser

This svg Image store in default location, but I need to send this SVG data to browser as a response

oneone help me

@http.httprequest

def  data_svg(self, req, id, db, uid, s_action=None, **kw):

    cr = pooler.get_db(db).cursor()

    pool = pooler.get_pool(db)

    model = pool.get('sample.svg')

    filename='SVG Image'

    obj=model.browse(cr, uid, int(id))

    if obj:

        filecontent = base64.b64decode(obj.data)

        filename = obj.name

        if filecontent and filename:

                return req.make_response(filecontent,

                                headers=[('Content-Type', 'application/octet-stream'),

                                 ('Content-Disposition', content_disposition(filename, req))])

return req.not_found()


<?xml version="1.0" encoding="utf-8" ?>

<svg baseProfile="full" height="100%" version="1.1" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"><defs /><rect fill="white" height="9cm" opacity="1" stroke-width="0" width="27cm" x="0cm" y="0cm" /><g><g id="vlines" stroke="lightgray"><line x1="0cm" x2="0cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="1mm" y="19mm">W 11</text><line x1="1cm" x2="1cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="11mm" y="19mm">T 12</text><line x1="2cm" x2="2cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="21mm" y="19mm">F 13</text><line x1="3cm" x2="3cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="31mm" y="19mm">S 14</text><line x1="4cm" x2="4cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="41mm" y="19mm">S 15</text><line x1="5cm" x2="5cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="51mm" y="19mm">M 16</text><text fill="black" font-family="Verdana" font-size="16" font-weight="bold" stroke="black" stroke-width="0" x="51mm" y="15mm">08</text><line x1="6cm" x2="6cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="61mm" y="19mm">T 17</text><line x1="7cm" x2="7cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="71mm" y="19mm">W 18</text><line x1="8cm" x2="8cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="81mm" y="19mm">T 19</text><line x1="9cm" x2="9cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="91mm" y="19mm">F 20</text><line x1="10cm" x2="10cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="101mm" y="19mm">S 21</text><line x1="11cm" x2="11cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="111mm" y="19mm">S 22</text><line x1="12cm" x2="12cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="121mm" y="19mm">M 23</text><text fill="black" font-family="Verdana" font-size="16" font-weight="bold" stroke="black" stroke-width="0" x="121mm" y="15mm">09</text><line x1="13cm" x2="13cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="131mm" y="19mm">T 24</text><line x1="14cm" x2="14cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="141mm" y="19mm">W 25</text><line x1="15cm" x2="15cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="151mm" y="19mm">T 26</text><line x1="16cm" x2="16cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="161mm" y="19mm">F 27</text><line x1="17cm" x2="17cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="171mm" y="19mm">S 28</text><line x1="18cm" x2="18cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="181mm" y="19mm">S 01</text><text fill="#800000" font-family="Verdana" font-size="18" font-weight="bold" stroke="#800000" stroke-width="0" x="181mm" y="10mm">March</text><line x1="19cm" x2="19cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="191mm" y="19mm">M 02</text><text fill="black" font-family="Verdana" font-size="16" font-weight="bold" stroke="black" stroke-width="0" x="191mm" y="15mm">10</text><line x1="20cm" x2="20cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="201mm" y="19mm">T 03</text><line x1="21cm" x2="21cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="211mm" y="19mm">W 04</text><line x1="22cm" x2="22cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="221mm" y="19mm">T 05</text><line x1="23cm" x2="23cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="231mm" y="19mm">F 06</text><line x1="24cm" x2="24cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="241mm" y="19mm">S 07</text><line x1="25cm" x2="25cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="251mm" y="19mm">S 08</text><line x1="26cm" x2="26cm" y1="2cm" y2="8cm" /><text fill="black" font-family="Verdana" font-size="12" stroke="black" stroke-width="0" x="261mm" y="19mm">M 09</text><text fill="black" font-family="Verdana" font-size="16" font-weight="bold" stroke="black" stroke-width="0" x="261mm" y="15mm">11</text><line x1="27cm" x2="27cm" y1="2cm" y2="8cm" /></g><g id="hlines" stroke="lightgray"><line x1="0cm" x2="27cm" y1="2cm" y2="2cm" /><line x1="0cm" x2="27cm" y1="3cm" y2="3cm" /><line x1="0cm" x2="27cm" y1="4cm" y2="4cm" /><line x1="0cm" x2="27cm" y1="5cm" y2="5cm" /><line x1="0cm" x2="27cm" y1="6cm" y2="6cm" /><line x1="0cm" x2="27cm" y1="7cm" y2="7cm" /><line x1="0cm" x2="27cm" y1="8cm" y2="8cm" /></g><line stroke="black" x1="0cm" x2="27cm" y1="2cm" y2="2cm" /><line stroke="black" x1="0cm" x2="27cm" y1="8cm" y2="8cm" /></g><g><g><text fill="black" font-family="Verdana" font-size="18" stroke="black" stroke-width="0" x="3mm" y="27mm">SS Hopper-4 nos_Wall Putty_PKL</text><rect fill="purple" height="5.4cm" opacity="0.5" stroke="lightgray" stroke-width="0" width="0.2cm" x="0.8mm" y="2.5cm" /><g><g id="SS_HOPPER_FABRICATION_WORK"><rect fill="#FF8080" height="8mm" opacity="0.85" stroke="#FF8080" stroke-width="2" width="258mm" x="1mm" y="31mm" /><rect fill="#909090" height="3mm" opacity="0.2" stroke="#FF8080" stroke-width="1" width="258mm" x="1mm" y="36mm" /><text fill="black" font-family="Verdana" font-size="15" stroke="black" stroke-width="0" x="2mm" y="35mm">SS HOPPER FABRICATION WORK</text><text fill="purple" font-family="Verdana" font-size="10" stroke="black" stroke-width="0" x="2mm" y="38.5mm">SS Hopper-4 nos_Wall Putty_PKL</text></g><g id="Top_middle_&_bottom_hopper_fabrication_work"><rect fill="#FFFF90" height="8mm" opacity="0.85" stroke="#FFFF90" stroke-width="2" width="208mm" x="1mm" y="41mm" /><rect fill="#909090" height="3mm" opacity="0.2" stroke="#FFFF90" stroke-width="1" width="208mm" x="1mm" y="46mm" /><text fill="black" font-family="Verdana" font-size="15" stroke="black" stroke-width="0" x="2mm" y="45mm">Top middle & bottom hopper fabrication work</text><text fill="purple" font-family="Verdana" font-size="10" stroke="black" stroke-width="0" x="2mm" y="48.5mm">SS Hopper-4 nos_Wall Putty_PKL</text></g><g id="All_area_welding_work"><rect fill="#FFFF90" height="8mm" opacity="0.85" stroke="#FFFF90" stroke-width="2" width="198mm" x="1mm" y="51mm" /><rect fill="#909090" height="3mm" opacity="0.2" stroke="#FFFF90" stroke-width="1" width="198mm" x="1mm" y="56mm" /><text fill="black" font-family="Verdana" font-size="15" stroke="black" stroke-width="0" x="2mm" y="55mm">All area welding work</text><text fill="purple" font-family="Verdana" font-size="10" stroke="black" stroke-width="0" x="2mm" y="58.5mm">SS Hopper-4 nos_Wall Putty_PKL</text></g><g id="Stool_pieces_&_accessories_fabrication_work"><rect fill="#FFFF90" height="8mm" opacity="0.85" stroke="#FFFF90" stroke-width="2" width="178mm" x="1mm" y="61mm" /><rect fill="#909090" height="3mm" opacity="0.2" stroke="#FFFF90" stroke-width="1" width="178mm" x="1mm" y="66mm" /><text fill="black" font-family="Verdana" font-size="15" stroke="black" stroke-width="0" x="2mm" y="65mm">Stool pieces & accessories fabrication work</text><text fill="purple" font-family="Verdana" font-size="10" stroke="black" stroke-width="0" x="2mm" y="68.5mm">SS Hopper-4 nos_Wall Putty_PKL</text></g><g id="Grinding_&_cleaning_work"><rect fill="#FFFF90" height="8mm" opacity="0.85" stroke="#FFFF90" stroke-width="2" width="68mm" x="1mm" y="71mm" /><rect fill="#909090" height="3mm" opacity="0.2" stroke="#FFFF90" stroke-width="1" width="68mm" x="1mm" y="76mm" /><text fill="black" font-family="Verdana" font-size="15" stroke="black" stroke-width="0" x="2mm" y="75mm">Grinding & cleaning work</text><text fill="purple" font-family="Verdana" font-size="10" stroke="black" stroke-width="0" x="2mm" y="78.5mm">SS Hopper-4 nos_Wall Putty_PKL</text></g></g></g><g /></g></svg><openerp.addons.vv_gantt.wizard.gantt.Project object at 0x7f6e661f8090>


Avatar
Discard
Related Posts Replies Views Activity
4
Oct 16
29679
1
Sep 15
2667
1
Jun 15
111
0
Apr 15
81
2
Apr 15
270