+@with_repo
+def display_editor(request, path, repo):
+
+ if not repo.file_exists(path, models.user_branch(request.user)):
+ try:
+ data = repo.get_file(path, 'default')
+ print type(data)
+
+ def new_file():
+ repo._add_file(path, data)
+ repo._commit(message='File import from default branch',
+ user=request.user.username)
+
+ repo.in_branch(new_file, models.user_branch(request.user) )
+ except hg.RepositoryException, e:
+ return direct_to_template(request, 'explorer/file_unavailble.html',\
+ extra_context = { 'path': path, 'error': e })
+