[17:22:28] hi [17:31:40] infobliss: see my message ^ [17:31:51] hi [17:32:05] ok zhuyifei1999_ [17:32:16] are you sending user generated content to the js? [17:32:38] or glam-generated (guess the same applies there to some extend) [17:32:44] not user generated, but glam generated [17:33:01] so still unacceptable [17:33:14] no js [17:33:19] what exactly is being send? [17:33:31] jinja templating [17:34:11] basvb: I already asked him to use jinja to process the lists [17:34:25] that issue was earlier [17:34:35] yeah [17:34:42] ok [17:35:17] https://stackoverflow.com/questions/15321431/how-to-pass-a-list-from-python-by-jinja2-to-javascript is that not applicable to the current process with jinja or is it? [17:35:42] it is okay to let jinja process it [17:36:15] just don't make it as if it is safe html [17:39:46] I am testing new code [17:39:56] give me 15 minutes [17:40:05] then we start the meeting [17:43:33] ok [17:55:59] yeah we may start now [17:56:16] so I have essentially done the following [17:56:47] 1. For the NA glam multiple image upload enabled. [17:57:03] 2. It's tested and is happening properly [17:57:32] But I have some flask related questions. [17:57:41] I believe the code can be made simpler. [17:57:47] The flow is as below: [17:57:56] or let me share the code first [17:58:07] https://gist.github.com/infobliss/558fad49abb0ec9ddc7c828482a48a31 [17:58:29] this needs modification to make it elegant [17:59:05] indeed [17:59:54] https://ibb.co/nh3GEk [18:00:36] unable to get the Unique ID and GLAM name in the https://gist.github.com/infobliss/558fad49abb0ec9ddc7c828482a48a31#file-app-py-L101 [18:01:15] In fact I would ideally like to have these two methods merged. [18:01:52] i.e., the uploadData() in the previous link and https://gist.github.com/infobliss/558fad49abb0ec9ddc7c828482a48a31#file-app-py-L49 [18:04:01] "1. For the NA glam multiple image upload enabled." are you making it glam specific? [18:04:03] /result vs /results [18:04:06] huh? [18:04:13] or does it also work genericly for other glams? [18:04:37] no it is not glam specific [18:05:00] other glams can be easily added [18:05:29] ok [18:05:39] it should be just enough to provide the functions needed [18:06:02] zhuyifei1999_ : /result vs /results <= please suggest me how to merge them. [18:06:34] what do they do [18:06:44] code_comments? [18:07:38] it's a draft [18:07:47] let me describe how they work here [18:07:47] also get rid of useless code in comments. git exists for a reason [18:08:04] and print statements [18:08:24] ok [18:08:46] so the flow is the following: [18:09:05] if you want to have permanent logging setup, use python logging module [18:09:41] ok I don't know about it now, I will find out [18:10:10] 1. there's the first html form that asks "glam name", "searchstring", "UUID", "categories". [18:10:24] does it always ask search string? [18:10:30] what if people do just the single upload [18:10:38] please wait [18:10:42] let me finish [18:10:43] also UUID like I said at least twice already is NA-specific [18:11:14] ok maybe a bit broader [18:11:21] but not the most informative for end-user [18:11:32] https://en.wikipedia.org/wiki/Universally_unique_identifier [18:13:27] but continue please, however please write these down on your list of things to do [18:13:44] it's small things, easy 10 minute fixes [18:15:29] ok [18:15:50] https://codeshare.io/a3PB14 [18:17:53] yes it means Submit button press [18:19:05] ok I made some remarks [18:19:20] categorisation works for both multiple images and single image? [18:19:37] also a good idea is to have some room with a small explanation per glam [18:20:04] + what's the status of the wikitext editing, is that still planned or is the current plan to just upload and leave that for onwiki (commons) editing [18:20:21] categorization is to be included for multiple images yet [18:20:55] I am open to your suggestion [18:21:04] wikitext editing won't be difficult [18:21:11] just add the one category to all images [18:21:25] so similar to one image upload [18:22:16] for 0 image there's no issue [18:22:24] the user will get an empty page [18:22:53] for 10000 images it will be very slow to load all of them [18:23:56] didn't you do a max amount per page/ [18:23:56] ? [18:24:02] not yet [18:24:10] ok so that's the solution I guess [18:24:15] and then load it per 100 [18:24:18] pagination is yet to be done [18:26:09] yep I get that, seems like a difficult step [18:26:14] maybe just max it out on 100 until then [18:26:33] yeah [18:26:51] I think we can also cap the number of images user can upload at a time [18:27:13] so that the process remains reasonably fast [18:27:30] by process I mean the uploading operation [18:28:36] it's also possible to make a note with a high number of uploads that uploading will be slow [18:29:35] ok [18:31:54] zhuyifei1999_ are you here? [18:32:01] yes? [18:32:09] great [18:32:32] you can also link to user uploads with more than 1 image uploaded [18:32:40] don't have to link all images [18:33:02] ok [18:34:06] zhuyifei1999_: Is it possible to access the data local to receiveData under @app.route('/result') in other methods? [18:35:41] ? [18:35:48] don't understand [18:36:09] I mean on submitting the first form "GLAM name", "Unique ID" etc were obtained in receiveData() [18:36:21] Can I access these two from UploadData()? [18:36:31] no [18:36:41] they are different requests [18:36:50] you can use session however [18:37:20] but that can break if you have two tabs [18:37:43] can there be two methods under same route? [18:38:02] no [18:38:06] why? [18:38:34] ideally I want to merge receivData() and UploadData() [18:38:55] so what is preventing that? [18:38:55] do they do the same function? [18:39:04] if not, don't [18:39:08] but these two receive data from different forms [18:39:10] what are the user stories, when do those functions get called? [18:39:14] in which situation? [18:39:29] then don't [18:40:01] different forms should have different handlers. if you mix them up things go unpredictable [18:40:27] when single image upload is done then on clicking Submit receiveData() is called [18:40:59] UploadData() essentially contains the checkbox choices in case of multiple uploads [18:41:16] the names are super confusing [18:41:20] so receivedata is also called for multi-upoad in step 1? [18:41:36] indeed reveiveData is common [18:42:36] then they seem to really represent two different pages so shouldn't merge indeed [18:43:01] the /result and /results paths are also very confusing as names [18:43:30] https://gist.github.com/infobliss/558fad49abb0ec9ddc7c828482a48a31 I'm used to calling the funciton the same as the app route [18:43:38] as it's doing the same thing [18:43:44] is related [18:44:25] I did not get you exactly [18:45:12] @app.route('/oauth-callback') def oauth_callback(): [18:45:15] it has the same name [18:45:21] @app.route('/results', methods=['POST']) def uploadData(): [18:45:24] totally different name [18:45:34] use the same name and make it a logical one [18:45:39] ok [18:45:43] the name describes what the function is doing [18:46:20] https://gist.github.com/infobliss/558fad49abb0ec9ddc7c828482a48a31#file-app-py-L97 [18:46:45] here uuid_list contains the UUIDs of all the images selected by user [18:46:50] so image gallery would be a good name [18:47:04] please rename uuid to id or identifier everywhere [18:47:13] ok [18:47:15] image_id [18:47:28] I want to access uuid_list in a different method [18:47:40] should I declare uuid_list as global? [18:47:44] send it to it like a function call? [18:48:03] upload_images(uuid_list) [18:48:09] which does: [18:48:20] for id in id_list: upload(id) [18:48:30] upload_image(id) [18:48:43] never declare as global [18:48:58] you end up shareing globals across all users [18:49:10] I want to access uuid_list here https://gist.github.com/infobliss/558fad49abb0ec9ddc7c828482a48a31#file-app-py-L101 [18:49:17] ok [18:49:22] * zhuyifei1999_ ends up hacking the tool :) [18:49:36] so can't you just call that function with the list? [18:49:43] and refer the user to the next page? [18:50:17] also I thought the function in line 101 was where the user has to select the images, but you say uuid list already contains the selected images [18:50:20] which one is it? [18:50:46] both [18:51:16] sorry uuid_list is all the images given by the search [18:51:45] ok [18:52:02] so the user doesn't have to provide any input when you load the new page [18:52:22] zhuyifei1999_ is more of an expert on this but won't just calling a function and showing a new page work? [18:52:32] no [18:52:43] each request is independent [18:53:13] after every request all the variables are garbage collected [18:53:16] so what's the best flow for returning a new page to the user based on input provided by that user (the id_list) [18:53:27] so you don't leak memory [18:54:23] the best flow? in this case it would be complicated [18:54:38] but the easiest way is to use session [18:55:07] but you will run into issues when you do concurrent uploads in multiple tabs on the same browser [18:55:21] concurrent is at the same time? [18:55:29] I can get into workarounds when we are as it [18:55:34] *at it [18:55:35] yes [18:55:56] ok, so I see the problem, but it's not very common [18:56:09] i.e. tab A search, tab B search, tab A upload (will use tab B data) [18:56:16] yep [18:56:25] so user does page A search [18:57:17] function F get's called and returns list L to the session S of the user which then get's forwarded to page B where the list L from session S is given as input? [18:57:40] no, session is server side [18:57:49] you read and write to it [18:58:07] think of it like a per-browser dict [18:59:17] ok (I'm not too familiar with front-end/js as you can see) [19:01:01] infobliss: do you follow still, because that is more important then whether I follow [19:01:19] which part? [19:02:39] the whole discussion? [19:02:40] I get that as soon as the new page is displayed the list L is garbage collected [19:07:29] zhuyifei1999_ : suppose user entered neither 'searchstring' nor 'unique id' [19:07:41] So I show him the same form again asking him to enter at least one\ [19:07:52] yes [19:08:03] but I wish to retain the other textbox entries as it is [19:08:12] i.e., the categories [19:08:38] ah good luck [19:09:44] that's a nice to have, not a required [19:10:11] ok [19:10:21] another reason why v2c use so much js [19:10:47] because you don't refresh and the forms won't reset [19:12:39] Ok got it [19:13:10] https://gist.github.com/infobliss/558fad49abb0ec9ddc7c828482a48a31#file-app-py-L20 [19:13:28] Do you discourage this? [19:14:08] ? [19:14:28] global variable [19:14:45] no, it's a constant [19:14:55] constants are okay [19:15:04] they never get changed [19:15:16] ok I see [19:15:27] but changing stuffs should not be global [19:15:41] right [19:15:45] otherwise the state is shared among all requests / users [19:16:22] ok [19:17:31] alright tomorrow I will incorporate today's comments into code [19:17:58] after that may we try experimenting with our 2nd GLAM? [19:18:30] basvb : what do you say? [19:18:53] yes, I hope to get that finished this weekend [19:19:01] it will force the functions to be generic [19:19:31] yes [19:20:12] meanwhile I will try my hand in supporting pagination as well [19:21:17] doesn't that depend on the sessionstorage? [19:21:59] I will do my research and have a better idea [19:24:24] ok [19:24:46] zhuyifei1999_: is https://www.nczonline.net/blog/2009/07/21/introduction-to-sessionstorage/ correct or is that another concept? That seems to discuss client side storage [19:25:01] a sec [19:25:24] yep that's different [19:25:29] sure, just checking with you whether it's a good entry point before I send infobliss of in the wrong direction [19:25:29] ok [19:25:38] it's a per-tab storage [19:26:33] http://flask.pocoo.org/docs/0.12/quickstart/#sessions [19:32:10] oke I'm done for the day [19:32:13] see you tomorrow