On Thu, Jun 3, 2010 at 7:48 PM, kakarukeys <[email protected]> wrote: > On Jun 3, 7:23 pm, Russell Keith-Magee <[email protected]> > wrote: >> On Thu, Jun 3, 2010 at 6:31 PM, kakarukeys <[email protected]> wrote: >> > I am developing a django web app which does some web publishing >> > (pushing some data to website). My customer is already using >> > ExpressionEngine 2.0 for publishing, hopes that I can reuse the CMS >> > for any publishing purpose. They does not wish to redevelop the web >> > publishing platform in Django. >> >> > I'm asking if it is safe to... >> >> > use the technique documented in >> >http://docs.djangoproject.com/en/dev/howto/legacy-databases/ >> >> > to create models and do publishing using the models. So we will have >> > two web apps being able to access / query the database at the same >> > time. Will it cause issues like data corruption, etc? >> >> It should be entirely safe. You'll have the same transaction and >> consistency issues that exist whenever you have two clients attached >> to the same database, but that's just due to have two clients talking >> to the same database -- you would get the same problems if you had two >> EE users attached simultaneously. >> >> The only other potential risk is if you have large amounts of data >> consistency logic implemented in user code under Expression Engine. In >> this case, you will need to duplicate this logic on the Django side, >> and there's the risk that you might introduce errors as a result of >> inconsistencies between the two implementations. >> >> Yours, >> Russ Magee %-) > > Hi, > > Thanks. I find what you said rather abstract for me to understand. > Could you give a simple example scenario where that might happen > (referring to the "potential risk")?
Let's say you have a model with an integer field, but for some business-logic reason, the integer must be greater than 10. If this constraint is imposed at the database level, then you will never be able to save a model with a value of 5 for that field. However, if the constraint is imposed at the code level, you need to implement the validation logic twice -- once under EE, and once under Django. This means it's easy to inadvertently introduce errors; for example, you could implement x > 10 on EE, but x>= 10 under Django. This means that your Django client will be able to save a value of 10, but the same value will raise a validation error under EE. Identifying and testing for this sort of consistency is hard to do; so if you have a lot of data validation constraints like this, it's worth considering as a potential risk. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" 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/django-users?hl=en.

