Skip to content

Edit profile [WIP] #1229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

Edit profile [WIP] #1229

wants to merge 7 commits into from

Conversation

karan
Copy link

@karan karan commented Jun 4, 2016

WIP

What can be edited:

Future work needed:

  • Style the page
  • Allow editing username?
  • Allow editing email? This will likely be a separate form or page because there can be multiple emails and some can be primary.

@karan karan force-pushed the profile-edit-page branch from 89072df to 918cadc Compare June 8, 2016 16:54
@karan
Copy link
Author

karan commented Jun 8, 2016

@dstufft

I'm trying to make this form work but getting this error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/pyramid_debugtoolbar/panels/performance.py", line 57, in resource_timer_handler
    result = handler(request)
  File "/app/warehouse/raven.py", line 41, in raven_tween
    return handler(request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/tweens.py", line 62, in excview_tween
    reraise(*attrs['exc_info'])
  File "/usr/local/lib/python3.5/site-packages/pyramid/compat.py", line 148, in reraise
    raise value
  File "/usr/local/lib/python3.5/site-packages/pyramid/tweens.py", line 22, in excview_tween
    response = handler(request)
  File "/usr/local/lib/python3.5/site-packages/pyramid_tm/__init__.py", line 101, in tm_tween
    reraise(*exc_info)
  File "/usr/local/lib/python3.5/site-packages/pyramid_tm/compat.py", line 15, in reraise
    raise value
  File "/usr/local/lib/python3.5/site-packages/pyramid_tm/__init__.py", line 83, in tm_tween
    response = handler(request)
  File "/app/warehouse/cache/http.py", line 69, in conditional_http_tween
    response = handler(request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/router.py", line 158, in handle_request
    view_name
  File "/usr/local/lib/python3.5/site-packages/pyramid/view.py", line 547, in _call_view
    response = view_callable(context, request)
  File "/app/warehouse/cache/http.py", line 33, in wrapped
    return view(context, request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/viewderivers.py", line 512, in csrf_view
    return view(context, request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/viewderivers.py", line 442, in rendered_view
    result = view(context, request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/viewderivers.py", line 147, in _requestonly_view
    response = view(request)
  File "/app/warehouse/accounts/views.py", line 84, in edit_profile
    user_service.db.commit()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 801, in commit
    self.transaction.commit()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 392, in commit
    self._prepare_impl()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 361, in _prepare_impl
    self.session.dispatch.before_commit(self.session)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/event/attr.py", line 256, in __call__
    fn(*args, **kw)
  File "/usr/local/lib/python3.5/site-packages/zope/sqlalchemy/datamanager.py", line 248, in before_commit
    "Transaction must be committed using the transaction manager"
AssertionError: Transaction must be committed using the transaction manager

What's the right way to update the user model?

@dstufft
Copy link
Member

dstufft commented Jun 8, 2016

@karan You don't ever need to manage the database transaction, that's handled automatically for you. I think you can just delete both the commit() and the flush() calls and it should work.

@dstufft
Copy link
Member

dstufft commented Jun 8, 2016

To be clear, you should never need to call commit() in a view, you might, in some rare cases need to call flush() but that should be very rare.

@karan karan force-pushed the profile-edit-page branch from d3909d5 to 0157041 Compare June 22, 2016 16:30
@gsb-eng
Copy link
Contributor

gsb-eng commented Jan 26, 2017

@karan Are you still working on this? If not, Can I takeover?

@karan
Copy link
Author

karan commented Feb 5, 2017

@gsb-eng I'm not. Please feel free to take over.

@gsb-eng
Copy link
Contributor

gsb-eng commented Mar 15, 2017

@karan : I've started implementing this and raised #1847 along with your contributions. I think this PR should be closed?

@nlhkabu
Copy link
Contributor

nlhkabu commented May 13, 2017

Closing this in favor of #1847. Let me know if this is an error and we can reopen if needed.

@nlhkabu nlhkabu closed this May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants