pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
Res facta quae tamen fingi potuit ([personal profile] pauamma) wrote in [site community profile] dw_dev_training2012-06-22 06:09 pm
Entry tags:

Question thread #7

It's time (more than time, actually) for another question thread!

The rules:

- You may ask any dev-related question you have in a comment. (It doesn't even need to be about Dreamwidth, although if it involves a language/library/framework/database Dreamwidth doesn't use, you will probably get answers pointing that out and suggesting a better place to ask.)
- You may also answer any question, using the guidelines given in To Answer, Or Not To Answer.
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2012-06-23 12:39 am (UTC)(link)
Ohhh, I never did teach you about userprops! Fortunately the wiki documentation is pretty good there. If you're using a userprop, the whole thing is abstracted away pretty well and you don't have to worry about DB stuff.

For the rest, most things have methods in cgi-bin/LJ/User.pm (and that's the best way to abstract things: you don't call the DB directly in the page your'e writing, you call the User.pm method to call the DB, so if you ever need to change it it's only one place to change it); things that are one-offs, or have been around for ages and not converted to using that method, may have the SQL statements in the code itself, but it really shouldn't.
momijizukamori: Green icon with white text - 'I do believe in phosphorylation! I do!' with a string of DNA basepairs on the bottom (Default)

[personal profile] momijizukamori 2012-06-23 10:41 am (UTC)(link)
Good to know! Do we have seperate stuff like that for manipulating other parts of the database, like styles info? Some of the bugs I'm looking at involve the official styles rather than wizard layers or whatever (eg, the styles subcategory bug involves reading and writing s2lids to the database, probably in a new table).
exor674: Computer Science is my girlfriend (Default)

[personal profile] exor674 2012-06-23 04:20 pm (UTC)(link)
We are trying to make it so we aren't running SQL queries straight from pages ( admin pages are sometimes an exception ) and instead writing "models" for everything.

If you mean whatI think you mean, the code for that is in LJ::S2Theme, I don't recall if I actually wrote the editing code into the module or just inlined that into the admin page.
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2012-06-23 08:21 pm (UTC)(link)
That one's more complex and I don't know. :) I know the system styles are read in via update-db.pl but I don't know what else! (I am cheerfully ignorant of anything and everything S2-ish.)