Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intensive Restrucutre Notes #23

Closed
hupili opened this issue Oct 1, 2012 · 5 comments
Closed

Intensive Restrucutre Notes #23

hupili opened this issue Oct 1, 2012 · 5 comments

Comments

@hupili
Copy link
Owner

hupili commented Oct 1, 2012

Record restructures in milestone 3. Branch is "dev".

After restructure "test/" and "app/" may become invalid. Call for more test.

@uxian

@hupili
Copy link
Owner Author

hupili commented Oct 1, 2012

Upgrades so far.

Framework:

  • "platform.py", new mechanism to reference different platforms.
  • Platforms appear as classes, which should be imported in "init.py" of "plugin" or "plugin_trial".
  • Multiple platforms can be merged to one module. e.g. "renren.py" contains RenrenStatus and RenrenShare. This encourages reuse of common methods.
  • Do not manually assign "platform" in code. Original mechanism requires multiple platform string assignment. When one platform needs to be renamed, it's inconvenient. Current solution is to automatically assign platform to Platform class and Message class according to the name of Platform class.
  • "Status" --> "Message", renaming for more general abstraction.
  • Rename snsapi --> snsbase. SNSBase. (Avoid ambiguity, for we have "snsapi" else where in this project).
  • Message class appear under the hierarchy of Platform class. --> Reduce naming burden. (SinaWeiboStatus.Message, TecentWeiboStatus.Message, snstypeMessage, etc.)
  • Errors are re-organised into a tree. e.g. "from errors import snserror", "snserror.config.nofile". snserror is now the conventional entry to reference errors.
  • Unified the naming.See issue Rename QQ to Tencent Weibo #15

Feature:

  • Use "list_platform()" in snscli to check currently available platforms. This is the name you put into ".json" configs.
  • Status_list(MessageList): print line number by default.

Issue:

  • Resolve input encoding issue, which is a companion of the console_output issue we discussed. Now every message inside snsapi should be unicode. Two variables in "snsconf.py" control the encoding snsapi uses to interact with console. See commit af7c548

@hupili
Copy link
Owner Author

hupili commented Oct 2, 2012

Restructure for #14:

  • compare
  • parse() is now parameter-less.
  • parse() read self.raw and write result to self.parsed.

Three level of dump for Message:

  • dump(): text-formatted console output
  • dump_parsed(): json-formatted interface output (pretty print)
  • dump_full(): json-formatted complete output (for archive)

@hupili
Copy link
Owner Author

hupili commented Oct 7, 2012

4e31211 solves issue #22

Now the channel configs should be self contained. Just call "Platform.new_channel()", it will return a json compatible object saying those fields required by this channel. Calling with "full = True" will return optional fields for this channel. Users don't have to learn the fields required by each channel and write 'channel.json' beforehand.

@ghost ghost assigned hupili Oct 11, 2012
@hupili
Copy link
Owner Author

hupili commented Oct 18, 2012

  • Message class attributes are enriched. They are in two groups: mandatory and optional. 'mandatory' include username, time, text, userid. Optional fields are like "author", "link", "reposts_count", "test_orig", etc. The "text" field does not have to corresponds to a certain field in the original returned json object. They can be re-organised to present more information for users. See cbc8eb3 for the current effect of snscli.
  • Message class support self digestion. This provides a standard entry for de-duplication.

@hupili
Copy link
Owner Author

hupili commented Oct 27, 2012

81 commits are pushed to master now.

@hupili hupili closed this as completed Oct 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant