comparison rhodecode/controllers/admin/gists.py @ 4030:647308db13ff

Added codemirror syntax mode in gists. - autopropose file extension when syntax mode is choosen
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 21 Jun 2013 02:42:32 +0200
parents 73f7149f2cc0
children ffd45b185016
comparison
equal deleted inserted replaced
4029:c9bcfe2d2ade 4030:647308db13ff
92 self.__load_defaults() 92 self.__load_defaults()
93 gist_form = GistForm([x[0] for x in c.lifetime_values])() 93 gist_form = GistForm([x[0] for x in c.lifetime_values])()
94 try: 94 try:
95 form_result = gist_form.to_python(dict(request.POST)) 95 form_result = gist_form.to_python(dict(request.POST))
96 #TODO: multiple files support, from the form 96 #TODO: multiple files support, from the form
97 filename = form_result['filename'] or 'gistfile1.txt'
97 nodes = { 98 nodes = {
98 form_result['filename'] or 'gistfile1.txt': { 99 filename: {
99 'content': form_result['content'], 100 'content': form_result['content'],
100 'lexer': None # autodetect 101 'lexer': form_result['mimetype'] # None is autodetect
101 } 102 }
102 } 103 }
103 _public = form_result['public'] 104 _public = form_result['public']
104 gist_type = Gist.GIST_PUBLIC if _public else Gist.GIST_PRIVATE 105 gist_type = Gist.GIST_PUBLIC if _public else Gist.GIST_PRIVATE
105 gist = GistModel().create( 106 gist = GistModel().create(