import os

mylang = 'test'
family = 'wikipedia'


custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
    with open(custom_path, 'rb') as f:
        exec(compile(f.read(), custom_path, 'exec'), globals())

    del f
# Clean up temp variables, since pwb issues a warning otherwise
# to help people catch misspelt config
del custom_path

# Things that should be non-easily-overridable
usernames[family]['*'] = os.environ['JPY_USER']

# If OAuth integration is available, take it
if 'CLIENT_ID' in os.environ:
    authenticate['*'] = (
        os.environ['CLIENT_ID'],
        os.environ['CLIENT_SECRET'],
        os.environ['ACCESS_KEY'],
        os.environ['ACCESS_SECRET']
    )

import os

mylang = 'test'
family = 'wikipedia'


custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
    with open(custom_path, 'rb') as f:
        exec(compile(f.read(), custom_path, 'exec'), globals())

    del f
# Clean up temp variables, since pwb issues a warning otherwise
# to help people catch misspelt config
del custom_path

# Things that should be non-easily-overridable
for fam in (
        'wikipedia', 'commons', 'meta', 'wikiboots', 'wikimedia',
        'wikiquote', 'wikisource', 'wikisource', 'wiktionary', 'wikiversity',
        'wikidata', 'mediawiki'
):
    usernames[fam]['*'] = os.environ['JPY_USER']

del fam

# If OAuth integration is available, take it
if 'CLIENT_ID' in os.environ:
    authenticate['*'] = (
        os.environ['CLIENT_ID'],
        os.environ['CLIENT_SECRET'],
        os.environ['ACCESS_KEY'],
        os.environ['ACCESS_SECRET']
    )

Fix OAuth integration for all wiki families
Fix OAuth integration for all wiki families

Earlier you needed to edit config file to set family to
whatever you were working on, even if you constructed a
Site object referring to other website. This would cause
funky errors about 'Logged in as X, expected None' errors.

Fix by listing almost all the families people will want to
use!

  import os
  
  mylang = 'test'
  family = 'wikipedia'
  
  
  custom_path = os.path.expanduser('~/user-config.py')
  if os.path.exists(custom_path):
      with open(custom_path, 'rb') as f:
          exec(compile(f.read(), custom_path, 'exec'), globals())
  
      del f
  # Clean up temp variables, since pwb issues a warning otherwise
  # to help people catch misspelt config
  del custom_path
  
  # Things that should be non-easily-overridable
+ for fam in (
+         'wikipedia', 'commons', 'meta', 'wikiboots', 'wikimedia',
+         'wikiquote', 'wikisource', 'wikisource', 'wiktionary', 'wikiversity',
+         'wikidata', 'mediawiki'
+ ):
- usernames[family]['*'] = os.environ['JPY_USER']
+     usernames[fam]['*'] = os.environ['JPY_USER']
+ 
+ del fam
  
  # If OAuth integration is available, take it
  if 'CLIENT_ID' in os.environ:
      authenticate['*'] = (
          os.environ['CLIENT_ID'],
          os.environ['CLIENT_SECRET'],
          os.environ['ACCESS_KEY'],
          os.environ['ACCESS_SECRET']
      )
  
Fix OAuth integration for all wiki families
## Code Before:
import os

mylang = 'test'
family = 'wikipedia'


custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
    with open(custom_path, 'rb') as f:
        exec(compile(f.read(), custom_path, 'exec'), globals())

    del f
# Clean up temp variables, since pwb issues a warning otherwise
# to help people catch misspelt config
del custom_path

# Things that should be non-easily-overridable
usernames[family]['*'] = os.environ['JPY_USER']

# If OAuth integration is available, take it
if 'CLIENT_ID' in os.environ:
    authenticate['*'] = (
        os.environ['CLIENT_ID'],
        os.environ['CLIENT_SECRET'],
        os.environ['ACCESS_KEY'],
        os.environ['ACCESS_SECRET']
    )

## Instruction:
Fix OAuth integration for all wiki families
## Code After:
import os

mylang = 'test'
family = 'wikipedia'


custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
    with open(custom_path, 'rb') as f:
        exec(compile(f.read(), custom_path, 'exec'), globals())

    del f
# Clean up temp variables, since pwb issues a warning otherwise
# to help people catch misspelt config
del custom_path

# Things that should be non-easily-overridable
for fam in (
        'wikipedia', 'commons', 'meta', 'wikiboots', 'wikimedia',
        'wikiquote', 'wikisource', 'wikisource', 'wiktionary', 'wikiversity',
        'wikidata', 'mediawiki'
):
    usernames[fam]['*'] = os.environ['JPY_USER']

del fam

# If OAuth integration is available, take it
if 'CLIENT_ID' in os.environ:
    authenticate['*'] = (
        os.environ['CLIENT_ID'],
        os.environ['CLIENT_SECRET'],
        os.environ['ACCESS_KEY'],
        os.environ['ACCESS_SECRET']
    )
