1. Marcin Kuzminski
  2. RhodeCode
  3. Issues

Issues

Issue #418 resolved

inserting comment : ProgrammingError: (ProgrammingError) can't adapt type 'literal'

Anonymous created an issue

Hi,

We have a setup with Postgresql and users in ldap, when trying to insert a comment in a changeset, I get this error

{{{ ProgrammingError: (ProgrammingError) can't adapt type 'literal' 'INSERT INTO notifications (subject, body, created_by, created_on, type) VALUES (%(subject)s, %(body)s, %(created_by)s, %(created_on)s, %(type)s) RETURNING notifications.notification_id' {'body': u'un truc comme \xe7a marche pas sous windows \u2192 utiliser os.path.join', 'created_on': datetime.datetime(2012, 3, 30, 0, 24, 29, 734587), 'type': u'cs_comment', 'created_by': 4, 'subject': literal(u'<a href="https://anybox.fr/rhode/anybox_openerp/changeset/31c8440ba52b6a67bc1a5d76e882e75ab117ab28#comment-16">Re commit: Add template paster for create OpenERP Module on line n11</a>')} }}}

Comments (6)

  1. Marcin Kuzminski repo owner

    Not sure how that happens for you(for me/demo/tests it works ok) since literal should be converted to unicode... but anyway i made sure that casting is made before, so in latest tip of beta branch that should not happen anymore

  2. Gregor Geiermann

    We just installed the latest version of Rhodecode (2.1.0) an had exactly the same issue when using PostgreSQL.

    Switching to SQLite solved the problem.

    Error message:

    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/weberror/errormiddleware.py', line 162 in __call__
      app_iter = self.application(environ, sr_checker)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/beaker/middleware.py', line 155 in __call__
      return self.wrap_app(environ, session_start_response)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/routes/middleware.py', line 131 in __call__
      response = self.app(environ, start_response)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/pylons/wsgiapp.py', line 107 in __call__
      response = self.dispatch(controller, environ, start_response)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/pylons/wsgiapp.py', line 312 in dispatch
      return controller(environ, start_response)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/rhodecode/lib/base.py', line 358 in __call__
      return WSGIController.__call__(self, environ, start_response)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/pylons/controllers/core.py', line 211 in __call__
      response = self._dispatch_call()
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/pylons/controllers/core.py', line 162 in _dispatch_call
      response = self._inspect_call(func)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/pylons/controllers/core.py', line 105 in _inspect_call
      result = self._perform_call(func, args)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/pylons/controllers/core.py', line 57 in _perform_call
      return func(**args)
    File '<string>', line 2 in comment
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/rhodecode/lib/auth.py', line 761 in __wrapper
      return func(*fargs, **fkwargs)
    File '<string>', line 2 in comment
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/rhodecode/lib/auth.py', line 798 in __wrapper
      return func(*fargs, **fkwargs)
    File '<string>', line 2 in comment
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/rhodecode/lib/auth.py', line 820 in __wrapper
      return func(*fargs, **fkwargs)
    File '<string>', line 2 in comment
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/rhodecode/lib/utils.py', line 839 in jsonify
      data = func(*args, **kwargs)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/rhodecode/controllers/changeset.py', line 393 in comment
      Session().commit()
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/session.py', line 710 in commit
      self.transaction.commit()
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/session.py', line 368 in commit
      self._prepare_impl()
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/session.py', line 347 in _prepare_impl
      self.session.flush()
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/session.py', line 1734 in flush
      self._flush(objects)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/session.py', line 1805 in _flush
      flush_context.execute()
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py', line 331 in execute
      rec.execute(self)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py', line 475 in execute
      uow
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/persistence.py', line 64 in save_obj
      table, insert)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/orm/persistence.py', line 558 in _emit_insert_statements
      execute(statement, params)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/engine/base.py', line 1449 in execute
      params)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/engine/base.py', line 1584 in _execute_clauseelement
      compiled_sql, distilled_params
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/engine/base.py', line 1698 in _execute_context
      context)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/engine/base.py', line 1691 in _execute_context
      context)
    File '/usr/local/lib/python-virtualenv/rhodecode/lib/python2.6/site-packages/sqlalchemy/engine/default.py', line 331 in do_execute
      cursor.execute(statement, parameters)
    ProgrammingError: (ProgrammingError) can't adapt type 'literal' 'INSERT INTO notifications (subject, body, created_by, created_on, type) VALUES (%(subject)s, %(body)s, %(created_by)s, %(created_on)s, %(type)s) RETURNING notifications.notification_id' {'body': u'csdcsdc', 'created_on': datetime.datetime(2013, 10, 7, 17, 20, 5, 466994), 'type': u'cs_comment', 'created_by': 8, 'subject': literal(u'<a href="http://path to repo/changeset/fd0651641c06e302ba8a6811c5cef199b6046aaa#comment-5">Re changeset: fd0651641c06 on line o3</a>')}
    
    
    CGI Variables
    -------------
      CONTENT_TYPE: 'application/x-www-form-urlencoded; charset=utf-8'
      HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
      HTTP_ACCEPT_ENCODING: 'gzip, deflate'
      HTTP_ACCEPT_LANGUAGE: 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3'
      HTTP_CACHE_CONTROL: 'no-cache'
      HTTP_CONNECTION: 'Keep-Alive'
      HTTP_COOKIE: 'rhodecode=34c03c1f164fafd99ba25b49fe5c6a6148e7a17bff56b1fa392d4280bf622aa25637df6d'
      HTTP_DNT: '1'
      HTTP_PRAGMA: 'no-cache'
      HTTP_USER_AGENT: 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130626 Firefox/17.0 Iceweasel/17.0.7'
      HTTP_X_PARTIAL_XHR: 'true'
      HTTP_X_REQUESTED_WITH: 'XMLHttpRequest'
      REMOTE_ADDR: '192.168.57.89'
      REQUEST_METHOD: 'POST'
      SCRIPT_NAME: '/rhodecode'
      SERVER_PORT: '5000'
      SERVER_PROTOCOL: 'HTTP/1.1'
      SERVER_SOFTWARE: 'waitress'
    
    
    WSGI Variables
    --------------
      application: <beaker.middleware.SessionMiddleware object at 0x3720090>
      beaker.get_session: <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x3720090>>
      beaker.session: {'_authentication_token': '0a6e7c26bdaccf0452e9b5811f717130a3f4a47e', 'rhodecode_user': {'username': u'gregor', 'is_authenticated': True, 'user_id': 8}, '_accessed_time': 1381159205.0731649, '_creation_time': 1381154550.2769339}
      paste.registry: <paste.registry.Registry object at 0x1a40ed0>
      paste.throw_errors: True
      pylons.action_method: <bound method ChangesetController.comment of <rhodecode.controllers.changeset.ChangesetController object at 0x37276d0>>
      pylons.controller: <rhodecode.controllers.changeset.ChangesetController object at 0x37276d0>
      pylons.environ_config: {'session': 'beaker.session', 'cache': 'beaker.cache'}
      pylons.pylons: <pylons.util.PylonsContext object at 0x3801ed0>
      pylons.routes_dict: {'action': u'comment', 'controller': u'changeset', 'revision': u'fd0651641c06e302ba8a6811c5cef199b6046aaa', 'repo_name': u'galileox'}
      routes.route: <routes.route.Route object at 0x3190e10>
      routes.url: <routes.util.URLGenerator object at 0x3801b10>
      webob._parsed_post_vars: (MultiDict([('text', 'csdcsdc'), ('f_path', 'gx/static/css/author_page.css'), ('line', 'o3')]), <FakeCGIBody at 0x37016d0 viewing MultiDict([('te...3')])>)
      webob._parsed_query_vars: (GET([]), '')
      webob.adhoc_attrs: {'errors': 'ignore', 'user': <AuthUser('id:8[gregor] ip:192.168.57.89 auth:True')>, 'language': 'en-us'}
      webob.is_body_readable: True
      webob.is_body_seekable: False
      wsgi process: 'Multithreaded'
      wsgi._org_proto: 'http'
      wsgi.file_wrapper: <class 'waitress.buffers.ReadOnlyFileBasedBuffer'>
      wsgiorg.routing_args: (<routes.util.URLGenerator object at 0x3801b10>, {'action': u'comment', 'controller': u'changeset', 'revision': u'fd0651641c06e302ba8a6811c5cef199b6046aaa', 'repo_name': u'galileox'})
    
  3. Log in to comment