django-rea / nrp

Network resource planning system.
GNU Affero General Public License v3.0
7 stars 1 forks source link

Revisit my Freedom Coop hacks #4

Open bhaugen opened 7 years ago

bhaugen commented 7 years ago

I did a bunch of hacks to get OCP to work for Freedom Coop. I made those hacks optional when I fixed this issue in the DEEP repo: https://github.com/gopacifia/DEEP/issues/2

But I need to revisit all of them from two perspectives:

You can see the hacks and how I made them optional in this commit: https://github.com/gopacifia/DEEP/commit/1303e6a7cb81650231e92f834c7d6e3e98b8cde3

I'll come back later and summarize them here and see if we can figure out how to make them less hacky.

I'm calling them a bug, although they seem to actually work in production, because they just shot @pospi in the foot trying to get his docker installation to run in development.

bhaugen commented 7 years ago

The hacks:

(I could have missed some other hacks, but those are the ones I made optional for DEEP to work.)

Clearly, GoPacifia and Matrioshka will not have an agent named "Freedom Coop". GoPacifia may not want to use FairCoins. And neither of them may have membership shares, or require memberships for any permissions.

Moreover, even OCP wants to support multiple currencies, both digital and otherwise.

Those hacks are all required for Freedom Coop, one way or another. I made them optional by adding another hack, settings.USE_FAIRCOINS. If this is False, then some of the other hacks do not apply. At least enough for DEEP to get up and running.

I think, if USE_FAIRCOINS == True, then all of those hacks will still work for OCP. But I haven't tested them.

And I'd like to make django-rea work for OCP without such hacks, which means figuring out better ways to enable the necessary features.

So what are the features?

All of those features could be supported by more settings. But they could also be supported by some configuration model in the database. Or some other way I have not thought of.

So, refactoring gang, please suggest better ways to support those features for OCP.

The OCP membership protocol is another feature that should also probably become optional, although we will need to find out from GoPacifia and Matrioshka if they want anything like it.

fosterlynn commented 7 years ago

Re. FairCoin hacks - seems like when integrating/interfacing Freecoin at the hackathon would be a great time to make the currency connections configurable and modular/pluggable in whatever way is best. And especially true if there will be work on interfacing a bank thing.

bhaugen commented 7 years ago

NameError at /work/profile/ global name 'use_faircoins' is not defined

This is because work.views.profile() does:

    balance = 0
    faircoin_account = None
    if use_faircoins:
        faircoin_account = agent.faircoin_resource()
        if faircoin_account:
            balance = faircoin_account.digital_currency_balance()

use_faircoins here is not necessary. This will all work fine as in the original code:

    faircoin_account = agent.faircoin_resource()
    balance = 0
    if faircoin_account:
        balance = faircoin_account.digital_currency_balance()
fosterlynn commented 7 years ago

@bum2 @XaviP do you know what the "business reason" for the Freedom Coop related permissions are? Sorry for corporate name for that, it is like the real reason in the organization (not thinking about the code so much). And what permissions are affected? That might help to define how to make it configurable.

XaviP commented 7 years ago

do you know what the "business reason" for the Freedom Coop related permissions are? Sorry for corporate name for that, it is like the real reason in the organization (not thinking about the code so much). And what permissions are affected? That might help to define how to make it configurable.

Sorry, I don't understand the question.

fosterlynn commented 7 years ago

do you know what the "business reason" for the Freedom Coop related permissions are? Sorry for corporate name for that, it is like the real reason in the organization (not thinking about the code so much). And what permissions are affected? That might help to define how to make it configurable.

Sorry, I don't understand the question.

Sorry, unclear. I'm looking for why we put in the Freedom Coop check in the first place. Why did we need it? If it is only permissions, then what permissions are allowed if Freedom Coop (or not Freedom Coop)? Is there something besides permissions that is only applicable to Freedom Coop (or not Freedom Coop)?

ghost commented 7 years ago

I'd work toward standardizing digital currencies under a unique gateway or facade. I think the ExchangeService is well suited for this. A transact method would make wonders given a recipient URI. We'd need to think of a URI scheme to address currencies. Think of account:iban:ES0920000000000000000000 or account:faircoin:<some_address>.