In my application I include the name of an organization in a .ics file 
name. Sometimes the name includes
characters that render an invalid file name, is there a way to prevent this 
form happening.

This is the code in the controller:

 def downloadVevent():
    name=None
    nodeID=int(request.args(0))
    response.view='download/vEvent.ics'
    node=retrieve_node(db, nodeID)
    if node:
        name=node.name
    else:
        redirect(URL('addressbook', 'router'))
    row=db(db.eventList.id==int(request.args(1))).select().first()
    vevent=response.render(name=name, row=row)
    return vevent.replace('\n\n', '\n')


This is the code for the file name:

{{response.headers['Content-Disposition'] = 
'attachment;filename=event_%s_%s.ics' % (IS_SLUG()(name)[0], 
row.startDate.strftime("%d-%m-%Y"))}}


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to