QuantifiedSelfless / gulper

data ingestion
4 stars 1 forks source link

Tos processor #33

Closed wannabeCitizen closed 8 years ago

wannabeCitizen commented 8 years ago

The Terms Of Service Game does not use any data and, in fact doesn't need an API. I added a processor simply so the Auth API could still return true. Feels important to keep consistency (and keep the riff-raff no-data users out)

I did it in compliance of how @mynameisfiber did recommend_processor with the class attribute Auth = false.

I feel like I don't even know if I need a handler at all. Will the Auth API work if I don't register a process handler? Plz review @mynameisfiber

mynameisfiber commented 8 years ago

@wannabeCitizen there's a default processor method implemented in BaseProcessor that just returns True... so not making your own basically just says 'let everyone in'. If you want consistency with the rest of the processors, simply have the class:

class TOSProcessor(BaseProcessor):
    name = 'tos_processor'
    auth = False

and your done. Remember you only need to do that super().__init__() thing if you want to customize the init... if you aren't doing anything you don't need it.

mynameisfiber commented 8 years ago

actually, one small thing needs to happen for that to work.... go to the basehandler and add the method:

def register_handlers(self):
    return []
wannabeCitizen commented 8 years ago

Aight, changed it according to your suggestions. This should be all good to review and merge.

mynameisfiber commented 8 years ago

@wannabeCitizen your merge now

wannabeCitizen commented 8 years ago

With that change the tos_processor handler doesn't get created at all. It had worked before though. Any thoughts on why it's not registering that handler?

mynameisfiber commented 8 years ago

is that what you mean?

wannabeCitizen commented 8 years ago

Yes, let me test

wannabeCitizen commented 8 years ago

Still not seeing a handler being created :(

wannabeCitizen commented 8 years ago

Err wait, got a handler, but it doesn't return name

wannabeCitizen commented 8 years ago

response:

{"data": [{"name": null, "userid": null, "rfid": "24002370", "permission": true}], "status_code": 200, "timestamp": 1461084358.258522}

Even though I'm using an rfid that has an attached user and the other processors return name.

mynameisfiber commented 8 years ago

this pull request started before the name pr was merged

wannabeCitizen commented 8 years ago

I merged master onto the branch before testing but after the names PR was merged

wannabeCitizen commented 8 years ago
✔ quantifieddev ~/data/gulper tos-processor > git merge master
Already up-to-date.
mynameisfiber commented 8 years ago

master versus this PR

wannabeCitizen commented 8 years ago

sorry not sure I get what that means. Isn't that PR merged into master as well?

mynameisfiber commented 8 years ago

it means your $ git merge master is wrong since master has the code to return a name and this branch doesn't.

wannabeCitizen commented 8 years ago

Sorry, but that's not the case, when I open that exact file, the lines are there:

            for userid in userids:
  11                 perm = yield exibperm.permission_meta(userid, name)
  10                 result.append({"userid": userid, "rfid": None,
   9                                "permission": perm['permission'],
   8                                "name": perm['name']})
   7             for rfid in rfids:
   6                 userid = yield rfidb.rfid_to_userid(rfid)
   5                 perm = yield exibperm.permission_meta(userid, name)
   4                 result.append({"userid": userid, "rfid": rfid,
   3                                "permission": perm['permission'],
   2                                "name": perm['name']})
wannabeCitizen commented 8 years ago

Also when I just merged pr0n updates and then remerged on tos_processor, I saw all the correct updates happen. I think however you modified Basehandler for tos_processor just doesn't grab the name for some reason.

mynameisfiber commented 8 years ago

-_- fine, i just did it in this pr

wannabeCitizen commented 8 years ago

Worked @mynameisfiber is a sexy beast. No denying that!