At the moment, the twitter module uses a hardcoded variable for defining the twitter host, making impossible to use a different service, for example for testing purposes. I will attach a patch for using a Drupal variable.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | host_and_protocol_configurable-1346790-9.patch | 2.51 KB | sjovanig |
| #8 | twitter_oauth_missing_server.patch | 401 bytes | jose reyero |
| #6 | 1346790_add_host_for_oauth_authentication_3.patch | 821 bytes | juampynr |
| #3 | use-variables-for-hosts-backport-D6-1346790-3.patch | 1.98 KB | sjovanig |
| #1 | use-variables-for-hosts-1346790-1.patch | 2.48 KB | David Hernández |
Comments
Comment #1
David Hernández commentedPatch attached
Comment #2
AlessMascherpa commentedTests passed ;)
Comment #3
sjovanig commentedBackported to D6
Comment #4
jjcarriontest passed
Comment #5
jonhattanComment #6
juampynr commentedThe patch given at http://drupal.org/node/1346790#comment-5266844 caused that a user was unable to add a Twitter account using OAuth. The attached patch fixes this issue.
Comment #7
juampynr commentedFixed and applied to 7.x branch.
http://drupalcode.org/project/twitter.git/commitdiff/a9f03daf0e2c17a1cf3...
Comment #8
jose reyero commentedThis introduced a bug, now TwitterOauth can't find the server because the constructor for this class is missing a call to the parent's contructor
Comment #9
sjovanig commentedI think introducing variable_set() and variable_get() inside Twitter class is not a good idea.
For abstraction questions the best solution is to use setters and getters to configure host or another class variable.
The patch I attach does:
Comment #10
juampynr commentedFinally did a mix of all suggestions. Now there is a TwitterConf class which implements the Singleton pattern. This allows us to change the host to a fake one during, for example, automated tests. Each test suite would have at the top the following code:
Commit for the Drupal 6 version.
Commit for the Drupal 7 version.
Please reopen if there is anything missing regarding the issue title.