I managed to follow where problem begin. When i update normal User
(Member) columns, eveything is ok, but if i update relational data of
User, then something happens. Here some more code:
# handle default email, address and phone for member
country =
model.Country.query().get(self.form_result['country'])
calling_code =
model.Country.query().get(self.form_result['calling_code'])
# POST OFFICE
try:
post_office =
model.PostOffice.query().filter(and_(model.PostOffice.name==self.form_result['post_office'],
model.Country.id==country.id)).one()
except Exception:
post_office = model.PostOffice(country=country,
name=self.form_result['post_office'])
# POST NUMBER
try:
post_number =
model.PostNumber.query().filter(and_(model.PostNumber.name==self.form_result['post_number'],
model.PostOffice.id==post_office.id)).one()
except Exception:
post_number =
model.PostNumber(post_office=post_office,
name=self.form_result['post_number'])
# ADDRESS
and_post_office =
and_(model.UserAddress.name==self.form_result['address'],
model.PostOffice.id==post_office.id, model.Member.id==c.member.id)
and_post_number =
and_(model.UserAddress.name==self.form_result['address'],
model.PostNumber.id==post_number.id, model.Member.id==c.member.id)
try:
user_address =
model.UserAddress.query().filter(or_(and_post_office,
and_post_number)).one()
except Exception:
user_address =
model.UserAddress(name=self.form_result['address'],
post_office=post_office, post_number=post_number, is_default=True)
c.member.default_address = user_address
model.DBSession.flush()
Now when i modify address of user or create a new address, then
password field is updated too and brokes...
-Marko
On Feb 21, 7:48 pm, mmstud <[EMAIL PROTECTED]> wrote:
> Elixir is 0.5.1 and SA 0.4.2p3.
>
> Im using this procedure as it was described with pylons application:
>
> from sqlalchemy.orm import scoped_session, sessionmaker
> import elixir
>
> # replace the elixir session with our own
> Session = scoped_session(sessionmaker(autoflush=True,
> transactional=True))
> elixir.session = DBSession = Session
> elixir.options_defaults.update({
> 'shortnames': True
>
> })
>
> # use the elixir metadata
> metadata = elixir.metadata
>
> # this will be called in config/environment.py
> def init_model(engine):
> metadata.bind = engine
>
> Any thoughts?
>
> On Feb 21, 5:01 pm, Jonathan LaCour <[EMAIL PROTECTED]>
> wrote:
>
> > mmstud wrote:
> > > When updating model, i see password is encrypted and updated as
> > > well even i dont change it and in my case encrypted pass gets
> > > encrypted, and next time over and over again, so password changes
> > > and string gets longer and longer. What might cause this and how
> > > it is prevented?
>
> > I cannot reproduce your problem in my testing. It seems to work
> > fine for me. Can you provide more details? What version of
> > SQLAlchemy are you using? What version of Elixir? Are you using
> > the default session included with Elixir, and if not how are you
> > creating and configuring your session?
>
> > --
> > Jonathan LaCourhttp://cleverdevil.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---